Commit Graph

341 Commits

Author SHA1 Message Date
Miro Hrončok
1a867b5ab7 Only BuildRequire wheel when setuptools < 71 2025-07-24 00:01:34 +02:00
Miro Hrončok
a4e0e04344 %pyproject_buildrequires: Do not generate BuildRequires from Requires core metadata fields
See https://packaging.python.org/en/latest/specifications/core-metadata/#requires

That field is deprecated and should include importable module names, not distribution packages.

We have no RPM Provides for importable names.
Treating this like python3dist() Requires is wrong and may result in stuff like:

    No match for argument: python3dist(pkg-resources)

For packages using python-distutils-extra.

See https://bugzilla.redhat.com/show_bug.cgi?id=2378463#c2

This bug existed from the very beginning of the %pyproject_buildrequires,
but the field is almost unused in real packages, so it was not noticed until
we asked all Python packages to be ported to the new macros.

---

I considered flattening the structure returned from requires_from_parsed_metadata_file,
but then we would need to hardcode "Requires-Dist" in various source= declarations,
so I kept the structure as is.
2025-07-11 12:34:57 +02:00
Miro Hrončok
f0b3a0b860 Avoid non-fatal errors in %pyproject_install with multiple wheels
Use double quotes around a shell variable that may contain spaces.

There were errors like:

    + '[' -z markupsafe==2.0.1 tldr==0.4.4 ']'
    /var/tmp/rpm-tmp.v6rA4u: line 55: [: markupsafe==2.0.1: binary operator expected

Or:

    + '[' -z nemo_audio_tab==6.4.0 nemo_compare==6.4.0 nemo_emblems==6.4.0 nemo_pastebin==6.4.0 nemo_terminal==6.4.0 ']'
    /var/tmp/rpm-tmp.BD4qxp: line 53: [: too many arguments

But considering the exit code of [ was non-zero, the built continued.
2025-07-10 11:07:05 +02:00
Miro Hrončok
38866ffe87 CI: Update tested pytest to fix build with Python 3.14
We got:

    DEBUG:   File "/builddir/build/BUILD/python-pytest-7.2.0-build/BUILDROOT/usr/lib/python3.14/site-packages/_pytest/assertion/rewrite.py", line 670, in run
    DEBUG:     and isinstance(item.value, ast.Str)
    DEBUG:                                ^^^^^^^
    DEBUG: AttributeError: module 'ast' has no attribute 'Str'

Version 8.0.2 builds in Fedora 43, 42, 41, EPEL 10 (still without tests).

The setup.py manipulation was moved to pluggy,
as pytest 8 no longer has setup.py.
2025-06-20 13:36:01 +02:00
570b5a6ee6
pyproject_buildrequires: don't pass config_settings as kwarg
PEP 517 says that the argument should be named config_settings but
pip/pyproject-hooks and other build frontends just pass it as a
positional argument, so some build backends name this argument other
things. Even though those build backends are wrong, it still makes sense
to align pyproject-rpm-macros with what the other frontends do.

Ref: https://github.com/PyO3/maturin/pull/2612
Ref: https://github.com/Rogdham/pyzstd/pull/2
2025-05-19 16:51:57 -05:00
Benson Muite
be0ace6df6 Mark Qt language files
Ensure translation files used in PyQt projects get marked as such.
2025-04-20 10:56:42 +03:00
Miro Hrončok
fc9cfbe360 CI: Adjust for normalized dist-info names with new setuptools 2025-04-11 21:05:34 +02:00
Miro Hrončok
5e1a6e91f0 Update comment wrt setuptools not putting licenses in licenses/ directory 2025-04-11 19:23:18 +02:00
Miro Hrončok
c1326723a9 Fix reverted conditional in %pyproject_buildrequires -t/-e Fedora version comparison 2025-03-21 14:49:58 +01:00
Miro Hrončok
fb7bcbb068 Allow %pyproject_buildrequires -t/-e without tox config on Fedora 40-42
This still does not allow %tox without tox config.
2025-03-21 12:08:13 +00:00
Miro Hrončok
d3dfd5fdb2 Make %pyproject_buildrequires -t/-e and %tox fail when no suitable tox configuration exists
Since tox 4, tox does not fail without configuration
(tox.ini, or tox section in setup.cfg/pyproject.toml).

As a result, packages that use %pyproject_buildrequires with -t or -e
without having a tox confuration
only generate additional BuildRequires on tox & tox-current-env itself.

More dangerously, %tox without tox configuration does nothing (and succeeds).
This behavior is dangerous and warrants an announced breakage.

Packagers of ~100 affected Fedora packages were informed about the problem earlier in
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/ZSHSHZKVA4XJQBJD7FMMCALKN4UP5SAJ/

There will be a further announcement and warning about this change.

EPEL 9 packages are not affected,
EPEL 9 has tox 3 which fails without config by default.

The change used a newly added option for tox-current-env: --assert-config.
This was added in tox-current-env 0.0.16:
https://github.com/fedora-python/tox-current-env/pull/89
2025-03-21 12:08:13 +00:00
Lumir Balhar
d1c632d76c Make dependencies in test_data order-independent
When updating setuptools from 74 to 76, order of extras has changed.
The order of the output is not considered stable and does not need to be asserted.
2025-03-17 08:20:11 +01:00
Miro Hrončok
e9f7ceb420 CI: Update the tested pluggy
Fedora 43 no longer has pytest 7.
2025-03-14 10:13:07 +01:00
Tomas Orsava
caad857e1a Mention ELN/CentOS Stream version needed for the Declarative Build System 2025-03-06 18:25:23 +01:00
Karolina Surma
b2862d315f PEP 639 is now accepted, remove the note about its provisional status 2025-02-27 13:44:24 +01:00
Miro Hrončok
ac4f008073 CI: Convert all test spec License tags to SPDX
python-ldap is a SPDX tag: https://spdx.org/licenses/python-ldap.html
2025-02-05 16:17:50 +01:00
Miro Hrončok
aac6644d02 Add the -M flag to %pyproject_save_files
- The flag can be used to indicate no Python modules should be saved

The change wrt users using '*' was necessary,
as `glob` was undefined when `module_globs` was empty.
2025-02-05 16:17:50 +01:00
Fedora Release Engineering
79d31f177e Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-18 11:18:54 +00:00
Miro Hrončok
ee9d130fdc Deprecate the provisional -w flag for %pyproject_buildrequires
The option was provisional, so it had no compatibility guarantees.
We keep the option anyway: there will be no removals just for the sake of removals.

All remaining usages in Fedora Rawhide have open Pull Requests to replace it with -p,
or remove it entirely.

Examples:

 https://src.fedoraproject.org/rpms/python-scikit-misc/pull-request/13
 https://src.fedoraproject.org/rpms/python-traitlets/pull-request/8
 https://src.fedoraproject.org/rpms/packit/pull-request/1402
2024-12-03 21:43:58 +01:00
Miro Hrončok
c1de18f683 Accept arbitrary options from %pyproject_buildrequires in pyproject-srpm-macros
This way, when we add new options to the actual macro in pyproject-rpm-macros,
spec files that use them are parsable with the old pyproject-srpm-macros package.

Last time, when we added the -g option in 1.16.0,
it took at least a week for Fedora CI to be able to parse a spec file with it,
as pyproject-srpm-macros 1.16.0+ needed to actually be installed on the CI systems.

Next time this happens, the new option will be parsable with older versions of pyproject-rpm-macros

Note that the (-) syntax is not supported yet on RPM 4.16 in RHEL 9.
I'd use an expression to keep the literal set of flags for older RPM versions:

    %pyproject_buildrequires(%[v"0%{?rpmversion}" >= v"4.19" ? "-" : "rRxtNwpe:g:C:"])

But macro options are not processed as macros:
https://github.com/rpm-software-management/rpm/issues/3440

As a result, this is not compatible with RHEL 9 and cannot be backported to it.
Unless the (-) syntax is backported:
https://issues.redhat.com/browse/RHEL-67161
https://gitlab.com/redhat/centos-stream/rpms/rpm/-/merge_requests/60
2024-12-03 12:58:44 +01:00
Miro Hrončok
d0e32d9246 CI: Rename in-tree patches to make them nicer in a single directory 2024-12-03 11:31:09 +01:00
Lukáš Zachar
cd00547996 Change the test source location
Change the test source location to support evolving downstream testing
requirements. This is needed both for downstream certification
activities and changes to test development for internal infrastructure
differences.

Cherry-picked from https://gitlab.com/redhat/centos-stream/rpms/pyproject-rpm-macros/-/merge_requests/25

Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
2024-12-02 13:34:42 +01:00
Miro Hrončok
665fd2456d CI: Simplify spec conditionals wrt Fedora 39 going EOL 2024-11-20 13:29:25 +01:00
Miro Hrončok
a69fb4e183 CI: %{pyproject_build_lib} changed on EL9
The actual value is still OK, but the tests were too strict.
2024-11-15 14:41:41 +01:00
Miro Hrončok
1532f1893f Fix one remaining test for setuptools 70+
This test was previously skipped because we didn't have new enough tox.
That's why it was never fixed for setuptools 70+.

This is a fixup for 20b7ac63f3
2024-11-13 14:01:09 +01:00
Miro Hrončok
4ddd57c537 Fixup the version-release 2024-11-07 17:14:52 +01:00
Miro Hrončok
20b7ac63f3 Support for setuptools 70+
- wheel is no longer generated as a dependency of the default build system
- test cases are adapted to support both old and new setuptools version
2024-11-07 13:00:47 +01:00
Miro Hrončok
8baa94160c %pyproject_buildrequires: Add support for dependency groups (PEP 735), via tox configuration 2024-11-06 13:31:41 +01:00
Miro Hrončok
307d2bef63 %pyproject_buildrequires: Add support for dependency groups (PEP 735), via the -g flag 2024-11-05 11:31:33 +01:00
Miro Hrončok
80d9abe0f4 Minor documentation clarification wrt -p/-w 2024-11-05 11:31:03 +01:00
Miro Hrončok
beceb2c94b PEP 639 is provisional, no longer a draft 2024-11-03 10:00:34 +01:00
Karolina Surma
bc6cb55227 Fix handling of self-referencing extras when reading pyproject.toml
Keep the information about the requirement extras by storing the
Requirement instances in the list of the ignored requirements, rather
than the strings in the form they were initially read from metadata.
The requirements strings read from pyproject.toml don't contain the
extra information, we insert the extra marker only after converting them to
Requirement instances. When stored as the text, the information about
the extra went missing in the course of the script.
2024-10-04 09:54:08 +02:00
Miro Hrončok
c7553b2c7d Even when %_auto_set_build_flags is disabled, set all compiler flags when building wheels
- Fixes: rhbz#2293616
2024-09-23 15:53:23 +02:00
Miro Hrončok
8a41ec5715 Don't generate a dependency on pip when %pyproject_buildrequires -N is used
- Fixes: rhbz#2294510
2024-09-23 14:39:00 +02:00
Karolina Surma
9f43e2a760 Add a possibility to read runtime dependencies from pyproject.toml
This adds a new flag, -p, to %pyproject_buildrequires.
When set, the runtime dependencies are read from the pyproject.toml's
[project] table.

See: https://bugzilla.redhat.com/2261939

pyproject_buildrequires.py already had a short `-p` option for
--python3_pkgversion (hidden from the macro users).
This change removes the one-letter option and leaves the long-one.
`-p` is now reused for reading dependencies from pyproject.toml
and made visible to the macro users.
2024-09-23 11:48:20 +02:00
Miro Hrončok
ab3dc0126a CI: Update setuptools_scm to a version that can be tested on EL9, EL10, Fedora 39-42 2024-09-07 12:42:44 +02:00
Miro Hrončok
459cda2e67 CI: python-ipykernel: Drop unneeded python3-ipyparallel dependency
It is not available in EPEL 10 and we can avoid it by excluding more imports,
which is what this spec file tests anyway.
2024-09-07 12:42:44 +02:00
Miro Hrončok
89374b9107 CI: python-virtualenv: Drop an unused dependency on python3-flaky
We don't have flaky in EL 10 yet.
2024-09-07 12:42:44 +02:00
Miro Hrončok
4a4614d13a CI: Use poetry-core in python-clikit.spec for EL10 compatibility 2024-09-07 12:42:44 +02:00
Miro Hrončok
32a3b5613f CI: Use flit_core in python-entrypoints.spec for EL10 compatibility 2024-09-07 12:42:44 +02:00
Miro Hrončok
049eb198d0 CI: Make python-pytest.spec build on EL 10 (but not on EL 9 anymore) 2024-09-07 12:42:44 +02:00
Miro Hrončok
dddc9bf556 CI: Use tomli rather than toml in fake-requirements.spec
toml is deprecated and not available on EL10.
2024-09-07 12:42:44 +02:00
Lumir Balhar
c8abf80acd Mark the license in the specfile as SPDX formula 2024-09-05 21:41:19 +00:00
Miro Hrončok
6f1ac1b126 CI: There is no EPEL 10 Next, use plain EPEL mock chroots on RHEL 10+ 2024-08-20 11:47:19 +02:00
Miro Hrončok
1278dd8dbd Extend rpmlintrc to filer out further non-errors
We got:

    pyproject-srpm-macros.noarch: W: unexpanded-macro Summary(C) %pyproject_buildrequires
    pyproject-srpm-macros.noarch: W: unexpanded-macro %description -l C %pyproject_buildrequires
    pyproject-srpm-macros.noarch: W: unexpanded-macro %description -l C %generate_buildrequires
    pyproject-rpm-macros.noarch: E: spelling-error ('cfg', '%description -l en_US cfg -> cf, cg, cog')
    pyproject-rpm-macros.noarch: E: spelling-error ('toml', '%description -l en_US toml -> tom, tome, toms')
    pyproject-rpm-macros.noarch: E: spelling-error ('setuptools', '%description -l en_US setuptools -> setup tools, setup-tools, footstools')
    pyproject-rpm-macros.src: E: spelling-error ('cfg', '%description -l en_US cfg -> cf, cg, cog')
    pyproject-rpm-macros.src: E: spelling-error ('toml', '%description -l en_US toml -> tom, tome, toms')
    pyproject-rpm-macros.src: E: spelling-error ('setuptools', '%description -l en_US setuptools -> setup tools, setup-tools, footstools')
    pyproject-srpm-macros.noarch: E: spelling-error ('buildrequires', 'Summary(en_US) buildrequires -> build requires, build-requires, requirements')
    pyproject-srpm-macros.noarch: E: spelling-error ('buildrequires', '%description -l en_US buildrequires -> build requires, build-requires, requirements')
    pyproject-srpm-macros.noarch: W: no-documentation
2024-08-05 23:22:26 +00:00
Miro Hrončok
7c4ffdcf84 CI: Make python-pluggy build on Fedora 41+ 2024-08-05 18:21:41 +02:00
Miro Hrončok
3539b832c8 CI: Allow platformdirs 4 in python-virtualenv.spec 2024-07-25 11:54:55 +02:00
Miro Hrončok
e7b37d02f8 Add a provisional RPM Declarative Buildsystem (RPM 4.20+) 2024-07-25 11:54:55 +02:00
Fedora Release Engineering
bc3d8013a4 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-19 08:56:55 +00:00
Miro Hrončok
436695615e Revert the temporary workaround for RPM 4.20 alpha 2 leaking \x1f (unit separators)
This reverts commit 996ac31b46.
2024-07-03 16:03:03 +02:00