Commit Graph

221 Commits

Author SHA1 Message Date
Miro Hrončok
ce3a144bca Don't exit from pyproject-srpm-macros implementation of %pyproject_buildrequires
- Fixes: rhbz#2391290

Consider code like this:

    %generate_buildrequires
    mv setup.py{,.ignore}
    %pyproject_buildrequires
    mv setup.py{.ignore,}

When %pyproject_buildrequires exits, the second mv is never executed.
The next round of %generate_buildrequires will then fail.

In fact, there is probably not a good reason to call exit from %pyproject_buildrequires.

From https://src.fedoraproject.org/rpms/libcpuid/pull-request/7

(cherry picked from Fedora commit ea56d1c870)
2025-12-01 16:42:40 +01:00
Lukáš Zachar
7f6b8131e3 CI: Drop STI and use tmt
Resolves: rhbz#2383022
(cherry picked from Fedora commit 84e6d30255)
2025-12-01 16:42:40 +01:00
Lukáš Zachar
63e4a347b8 CI: Respect TEST_ARTIFACTS but detect tmt
STI used to allow /tmp/artifacts, in tmt we have
TMT_PLAN_DATA and TMT_TEST_DATA. Use the later, which is test specific.

(cherry picked from Fedora commit 8998e8e027)
2025-12-01 16:42:40 +01:00
Fedora Release Engineering
33524ea761 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
(cherry picked from Fedora commit 3feea218e7)
2025-12-01 16:42:40 +01:00
Miro Hrončok
2db53e0c8b Only BuildRequire wheel when setuptools < 71
(cherry picked from Fedora commit 1a867b5ab7)
2025-12-01 16:42:40 +01:00
Miro Hrončok
0f43efad75 %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.

(cherry picked from Fedora commit a4e0e04344)
2025-12-01 16:42:40 +01:00
Miro Hrončok
07256169d8 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.

(cherry picked from Fedora commit f0b3a0b860)
2025-12-01 16:42:40 +01:00
a7d5f09d8e 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

(cherry picked from Fedora commit 570b5a6ee6)
2025-12-01 16:42:40 +01:00
Benson Muite
a2c98f1a7f Mark Qt language files
Ensure translation files used in PyQt projects get marked as such.

(cherry picked from Fedora commit be0ace6df6)
2025-12-01 16:42:40 +01:00
Miro Hrončok
ead97da470 CI: Adjust for normalized dist-info names with new setuptools
(cherry picked from Fedora commit fc9cfbe360)
2025-12-01 16:42:40 +01:00
Miro Hrončok
be843d3208 Update comment wrt setuptools not putting licenses in licenses/ directory
(cherry picked from Fedora commit 5e1a6e91f0)
2025-12-01 16:42:40 +01:00
Miro Hrončok
ce96a462c7 Fix reverted conditional in %pyproject_buildrequires -t/-e Fedora version comparison
(cherry picked from Fedora commit c1326723a9)
2025-12-01 16:42:40 +01:00
Miro Hrončok
f2e30c24db Allow %pyproject_buildrequires -t/-e without tox config on Fedora 40-42
This still does not allow %tox without tox config.

(cherry picked from Fedora commit fb7bcbb068)
2025-12-01 16:42:40 +01:00
Miro Hrončok
a82300a517 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

(cherry picked from Fedora commit d3dfd5fdb2)
2025-12-01 16:42:40 +01:00
Lumir Balhar
b3c0c29a02 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.

(cherry picked from Fedora commit d1c632d76c)
2025-12-01 16:42:40 +01:00
Tomas Orsava
8488e63dc9 Mention ELN/CentOS Stream version needed for the Declarative Build System
(cherry picked from Fedora commit caad857e1a)
2025-12-01 12:16:55 +01:00
Karolina Surma
2fa9ff9c53 PEP 639 is now accepted, remove the note about its provisional status
(cherry picked from Fedora commit b2862d315f)
2025-12-01 12:16:55 +01:00
Miro Hrončok
6b0ce0731f CI: Convert all test spec License tags to SPDX
python-ldap is a SPDX tag: https://spdx.org/licenses/python-ldap.html

(cherry picked from Fedora commit ac4f008073)
2025-12-01 12:16:55 +01:00
Miro Hrončok
b41772722e 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.

(cherry picked from Fedora commit aac6644d02)
2025-12-01 12:16:55 +01:00
Fedora Release Engineering
d1a643e8df Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
(cherry picked from Fedora commit 79d31f177e)
2025-12-01 12:16:55 +01:00
Miro Hrončok
4f03657be8 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

(cherry picked from Fedora commit ee9d130fdc)
2025-12-01 12:16:55 +01:00
Miro Hrončok
9210ff19a2 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

(cherry picked from Fedora commit c1de18f683)

Amended for RHEL 9 to require rpm-build >= 4.16.1.3-37 for the (-) syntax backport.
2025-12-01 12:16:55 +01:00
Miro Hrončok
bed337438a CI: Rename in-tree patches to make them nicer in a single directory
(cherry picked from Fedora commit d0e32d9246)
2025-12-01 12:16:55 +01:00
Miro Hrončok
39ab143d16 CI: Simplify spec conditionals wrt Fedora 39 going EOL
(cherry picked from Fedora commit 665fd2456d)
2025-12-01 12:16:55 +01:00
Miro Hrončok
4c800c37a1 RHEL 9 only: Fixup "Change the test source location" to match Fedora 2025-12-01 12:16:55 +01:00
Lukáš Zachar
2ed8664eb1 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.
2024-12-02 10:45:32 +01:00
Miro Hrončok
51c4b725b8 CI: %{pyproject_build_lib} changed on EL9
The actual value is still OK, but the tests were too strict.
2024-11-15 14:41:26 +01:00
Miro Hrončok
47b479923f CI: EL9-only: Skip tests we cannot run yet
(cherry picked from commit 2c94825e15)
2024-11-15 00:30:55 +01:00
Miro Hrončok
cc15860ccf 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

(cherry picked from commit 1532f1893f)
2024-11-15 00:29:10 +01:00
Miro Hrončok
e8d079ef42 Fixup the version-release
(cherry picked from commit 4ddd57c537)
2024-11-15 00:29:10 +01:00
Miro Hrončok
9ecce29cd3 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

(cherry picked from commit 20b7ac63f3)
2024-11-15 00:29:10 +01:00
Miro Hrončok
35f8482574 %pyproject_buildrequires: Add support for dependency groups (PEP 735), via tox configuration
(cherry picked from commit 8baa94160c)
2024-11-15 00:29:10 +01:00
Miro Hrončok
f1186740e0 %pyproject_buildrequires: Add support for dependency groups (PEP 735), via the -g flag
(cherry picked from commit 307d2bef63)
2024-11-15 00:29:10 +01:00
Miro Hrončok
db6c19e6ad Minor documentation clarification wrt -p/-w
(cherry picked from commit 80d9abe0f4)
2024-11-15 00:29:10 +01:00
Miro Hrončok
d3f9abe206 PEP 639 is provisional, no longer a draft
(cherry picked from commit beceb2c94b)
2024-11-15 00:29:10 +01:00
Karolina Surma
4c6bd08a70 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.

(cherry picked from commit bc6cb55227)
2024-11-15 00:29:10 +01:00
Miro Hrončok
c34065ccca Even when %_auto_set_build_flags is disabled, set all compiler flags when building wheels
- Fixes: rhbz#2293616

(cherry picked from commit c7553b2c7d)
2024-11-15 00:29:10 +01:00
Miro Hrončok
a33eda232e Don't generate a dependency on pip when %pyproject_buildrequires -N is used
- Fixes: rhbz#2294510

(cherry picked from commit 8a41ec5715)
2024-11-15 00:29:10 +01:00
Karolina Surma
a1488d18df 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.

(cherry picked from commit 9f43e2a760)
2024-11-15 00:29:10 +01:00
Miro Hrončok
4c735ba581 CI: Update setuptools_scm to a version that can be tested on EL9, EL10, Fedora 39-42
(cherry picked from commit ab3dc0126a)
2024-11-15 00:29:10 +01:00
Miro Hrončok
2240335879 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.

(cherry picked from commit 459cda2e67)
2024-11-15 00:29:10 +01:00
Miro Hrončok
55957facfa CI: python-virtualenv: Drop an unused dependency on python3-flaky
We don't have flaky in EL 10 yet.

(cherry picked from commit 89374b9107)
2024-11-15 00:29:10 +01:00
Miro Hrončok
4133370dea CI: Use poetry-core in python-clikit.spec for EL10 compatibility
(cherry picked from commit 4a4614d13a)
2024-11-15 00:29:10 +01:00
Miro Hrončok
388f35a082 CI: Use flit_core in python-entrypoints.spec for EL10 compatibility
(cherry picked from commit 32a3b5613f)
2024-11-15 00:29:10 +01:00
Miro Hrončok
07644782c4 CI: Use tomli rather than toml in fake-requirements.spec
toml is deprecated and not available on EL10.

(cherry picked from commit dddc9bf556)
2024-11-14 17:18:28 +01:00
Lumir Balhar
e161cd449e Mark the license in the specfile as SPDX formula
(cherry picked from commit c8abf80acd)
2024-11-14 17:18:21 +01:00
Miro Hrončok
e4aa6401af CI: There is no EPEL 10 Next, use plain EPEL mock chroots on RHEL 10+
(cherry picked from commit 6f1ac1b126)
2024-11-14 17:18:03 +01:00
Miro Hrončok
fdb5b80341 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

(cherry picked from commit 1278dd8dbd)
2024-11-14 17:17:50 +01:00
Miro Hrončok
082234e671 CI: Make python-pluggy build on Fedora 41+
(cherry picked from commit 7c4ffdcf84)
2024-11-14 17:16:35 +01:00
Miro Hrončok
bc854977a6 CI: Allow platformdirs 4 in python-virtualenv.spec
(cherry picked from commit 3539b832c8)
2024-11-14 17:16:08 +01:00