Commit Graph

152 Commits

Author SHA1 Message Date
Miro Hrončok 7e0207e048 Fix a typo in the latest changelog entry 2024-01-26 11:19:37 +01:00
Miro Hrončok fa2855f6ce Fix handling of tox 4 provision without tox minversion
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2240590

The added test actually blows up without the fix with both tox 4 or tox 3,
so perhaps this bug also existed with tox 3.
2024-01-26 11:19:37 +01:00
Miro Hrončok d95890489a Communicate loudly that this does not work with old RPM
I have seen several folks building this package in a RHEL 8 environment.
This won't prevent them doing so, but at least they will be forced to make changes,
acknowledging the fact that what they are doing has consequences.
2024-01-26 11:19:37 +01:00
Karolina Surma 47cfbcf6e3 Add %_pyproject_check_import_allow_no_modules
Macro which allows to pass the import check even if no Python modules
are detected in the package.
Only to be used in the automated environments.

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2024-01-26 11:19:35 +01:00
Carl George 39dc109d06 Fix PEP number typo 2024-01-26 11:16:14 +01:00
Miro Hrončok 3f1dd1c441 Use %rpmversion to check if we are on RPM 4.19+ 2024-01-26 11:15:16 +01:00
Miro Hrončok e7332c16ab CI: Don't treat DeprecationWarnings in setuptools_scm's %check as errors 2024-01-26 11:15:16 +01:00
Miro Hrončok a0c94e93cf CI: Update setuptools to make it build with Python 3.12
This still works on Fedora 37/38. EL 9 uses a different setuptools version for tests.
2024-01-26 11:15:16 +01:00
Miro Hrončok ff6ed86bff CI: Update poetry-core to workaround a weird FTBFS on Fedora 39+
This still builds on previous Fedoras and EPEL 9.
2024-01-26 11:15:16 +01:00
Miro Hrončok a594a93c9b CI: Update ipykernel to a version that no longer uses the imp module
This still works on Fedora 37 and 38. The c9s package skips this test.
2024-01-26 11:15:16 +01:00
Miro Hrončok d24b6f418d CI: Apply a FTBFS fix from Fedora 39 to the virtualenv spec 2024-01-26 11:15:16 +01:00
Miro Hrončok d578e3b8dc CI: Make pytest build on Fedora 37 to 39 as well as EPEL 9 2024-01-26 11:15:16 +01:00
Miro Hrončok 31f99e7ad0 CI: Run mock in verbose mode to see the logs 2024-01-26 11:15:16 +01:00
Miro Hrončok 5f5038f73e Run tests with Python 3.11 in %check (RHEL 9 specific)
Related: rhbz#2208971
2023-06-07 09:55:37 +02:00
Miro Hrončok ab6c5538e5 CI: Run a build of pyproject-rpm-macros.spec --with tox_tests (RHEL 9 specific)
Related: rhbz#2208971
2023-06-01 21:24:22 +02:00
Miro Hrončok e8933acb12 CI: Run a couple of Python 3.11 builds (RHEL 9 specific)
Related: rhbz#2208971
2023-06-01 21:24:22 +02:00
Miro Hrončok 6a97abbde7 Accept multiple values for the same config settings
Related: rhbz#2208971
2023-06-01 21:24:22 +02:00
Maxwell G 604f5069e0 document config_settings support
Related: rhbz#2208971
2023-06-01 21:24:22 +02:00
Maxwell G adcd28cfa9 buildrequires: make -C and -N mutually exclusive
Related: rhbz#2208971
2023-05-31 21:37:01 +02:00
Maxwell G 7f75263357 Allow passing config_settings to the build backend
Related: rhbz#2208971
2023-05-31 21:37:01 +02:00
Miro Hrončok d5a5919a27 Fix literal % handling in %{pyproject_files} on RPM 4.19
RPM 4.19 now requires 2 %s to escape a single literal % in the filelist.

The test has been adjusted to actually run our code
instead of only verifying the assumptions.

Related: rhbz#2208971
2023-05-31 18:21:18 +02:00
Miro Hrončok 1ca4dcdce7 Fix the conditional tests-related BuildRequires for Python version
python3-devel is not installed, hence the conditional needs to be on python3.
It only "worked" with toml because toml was pulled as a transitive dependency.

Related: rhbz#2208971
2023-05-31 09:52:27 +02:00
Miro Hrončok 9422982693 Use tomli for older Pythons, now when RHEL 9 has it
Related: rhbz#2208971
2023-05-31 09:52:27 +02:00
Miro Hrončok 9e4b88057b CI: Make python-virtualenv.spec EL9-compatible
Related: rhbz#2208971
2023-05-30 13:11:41 +02:00
Miro Hrončok 05fdbf4192 Make %pyproject_build_lib work with RPM 4.16
Related: rhbz#2208971
2023-05-30 11:24:39 +02:00
Miro Hrončok 1d24fae689 Bump the release for ELN dependency changes
Related: rhbz#2208971
2023-05-30 10:43:55 +02:00
Miro Hrončok fb1cb520d9 Don't run tox tests on RHEL by default, as tox is unwanted in RHEL
See https://github.com/fedora-eln/eln/issues/126

Related: rhbz#2208971
2023-05-30 10:43:53 +02:00
Miro Hrončok 146f0ece2e Use lowercase tox in test case names, as upstream wants it
Related: rhbz#2208971
2023-05-30 10:43:52 +02:00
Maxwell G 0dd9e91f43 don't use pytest-xdist in RHEL
Relates: https://github.com/fedora-eln/eln/issues/125

Related: rhbz#2208971
2023-05-30 10:43:49 +02:00
Miro Hrončok a7a8d6bda0 In %check, assert the two signatures of %pyproject_buildrequires match exactly
Related: rhbz#2208971
2023-05-30 10:43:47 +02:00
Miro Hrončok 3fae95fe3a Tests: Make them pass with setuptools < 60
This makes the tests work on EL 9 and Fedora 36.

 - Move metadata to setup.cfg in self-referential extras tests
 - Skip tests for pyproject.toml [project] metadata when setuptools < 60

Related: rhbz#2208971
2023-05-30 10:43:44 +02:00
Miro Hrončok 500d43c1c0 %pyproject_buildrequires: Add support for self-referential extras requirements
Related: rhbz#2208971
2023-05-30 10:43:42 +02:00
Miro Hrončok ccc11a3af7 Deprecate the provisional %{pyproject_build_lib} macro
There is no scheduled removal.

See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/HMLOPAU3RZLXD4BOJHTIPKI3I4U6U7OE/

Related: rhbz#2208971
2023-05-30 10:43:39 +02:00
Maxwell G fb9a851ec3 Simplify assertion in tests
Related: rhbz#2208971
2023-05-30 10:43:37 +02:00
Miro Hrončok e9b491535c Redirect stdout to stderr via Shell
Dependencies are recorded to a text file that is catted at the end.

This should prevent subtle bugs like https://bugzilla.redhat.com/2183519 in the future.

Related: rhbz#2208971
2023-05-30 10:43:35 +02:00
Miro Hrončok 000ca45f91 Remove duplicate import
Related: rhbz#2208971
2023-05-30 10:43:25 +02:00
Miro Hrončok 5ddb72e141 Acknowledge the license is MIT even in SPDX
$ askalono identify LICENSE
    License: MIT (original text)
    Score: 1.000

Related: rhbz#2208971
2023-05-30 10:39:13 +02:00
Lumir Balhar e828b8291a Remove .dist-info directory at the end of %pyproject_buildrequires
An incomplete .dist-info directory in $PWD can confuse tests in %check.
For example, virtualenv uses importlib.metadata to load its
entry points and it does not work when it finds a virtualenv...dist-info without them.

Related: rhbz#2208971
2023-05-30 10:37:26 +02:00
Miro Hrončok d46b0e5b01 CI: Unskip 1 skipped package and update comments for the remaining 2
Packages were introduced to EPEL9 in the meantime.

Related: rhbz#2168193
2023-02-13 16:42:58 +01:00
Lumir Balhar ea94129e35 Improve detection of lang files
Related: rhbz#2168193
2023-02-13 16:42:58 +01:00
Miro Hrončok 1a404c23b3 CI: Adjust spec conditionals for F35 EOL
Also, use %elif instead of a nested %if.

Related: rhbz#2168193
2023-02-13 16:42:58 +01:00
Miro Hrončok 6923c14ba5 %check: Use %pytest -n auto for faster build
The speedup is tiny but noticeable (pytest took 8.49s, now 5.87s on my 8-core workstation).

Related: rhbz#2168193
2023-02-13 16:42:58 +01:00
Miro Hrončok ecf0a140a8 %pyproject_buildrequires: Avoid leaking stdout from subprocesses
When the build backend prints to stdout via non-Python means,
for example when a setup.py script calls a verbose program via os.system(),
the output leaked to stdout of %pyproject_buildrequires was treated as generated BuildRequires.

Fore example, if the setup.py script has:

    rv = os.system('/usr/bin/patch -N -p3 -d build/lib < lib/py-lmdb/env-copy-txn.patch')

(From https://github.com/jnwatson/py-lmdb/blob/py-lmdb_1.0.0/setup.py#L117)

The stdout of /usr/bin/patch leaked to stdout of %pyproject_buildrequires:

    [lmdb-1.0.0]$ /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --python3_pkgversion 3 2>/dev/null
    python3dist(setuptools) >= 40.8
    python3dist(wheel)
    patching file lmdb.h
    patching file mdb.c
    python3dist(wheel)
    patching file lmdb.h
    patching file mdb.c

This resulted in DNF errors like this:

    No matching package to install: 'lmdb.h'
    No matching package to install: 'mdb.c'
    No matching package to install: 'patching'

Moreover, it resulted in bogus BuildRequires that may have existed (e.g. "file").

By replacing the usage of contextlib.redirect_stdout
(which only redirects Python's sys.stdout)
with a custom context manager that captures stdout on file descriptor level
(in addition to Python's sys.stdout),
we avoid this leak.

File descriptor magic heavily inspired by the capfd pytest fixture.

Related: rhbz#2168193
2023-02-13 16:42:58 +01:00
Miro Hrončok 159b22e742 Add pyproject-srpm-macros with a minimal %pyproject_buildrequires macro
pyproject-srpm-macros is intended to be installed in the default buildroot.

That way, no explicit BuildRequires for pyproject-rpm-macros are required,
as long as %pyproject_buildrequires is used in %generate_buildrequires.

When only pyproject-srpm-macros is installed, the minimal implementation of
%pyproject_buildrequires generates a dependency on pyproject-rpm-macros.
When pyproject-rpm-macros is installed, it overrides the implementation
of %pyproject_buildrequires with the full one.

Note that in Fedora, pyproject-rpm-macros is required by python3-devel,
but not in RHEL.
This allows us to keep pyproject-rpm-macros in the RHEL CRB repository.

Related: rhbz#2168193
2023-02-13 16:42:58 +01:00
Miro Hrončok 251f8e97c9 CI specs: Never use `! ...` as a check (followup)
This is a followup of 6015300d34

This particular instance was not discovered before due to the macro.

Related: rhbz#2168193
2023-02-13 16:42:58 +01:00
Miro Hrončok eb8a225689 CI: Adjust %toxenv tests for tox 4
Related: rhbz#2168193
2023-02-13 16:42:58 +01:00
Miro Hrončok a6c5229070 CI: Manually BR pkg_resources from dns-lexicon to fix FTBFS
setuptools (pkg_resources) were transitively pulled in by tox

Related: rhbz#2168193
2023-02-13 16:42:58 +01:00
Miro Hrončok df1ddd0ccd Adjust %pyproject_buildrequires tests for tox 4
Fixes: https://bugzilla.redhat.com/2160687

Related: rhbz#2168193
2023-02-13 16:42:58 +01:00
Miro Hrončok 81dd6d1601 CI: Keep patches near the specs to ease using the script from other dist-gits
That way, if a package (such as python-tox) uses it,
the patches in dist-git are available.
In the future, it also allows us to add patches without URLs to our tested spec files.

Related: rhbz#2168193
2023-02-13 16:42:58 +01:00
Ralf Ertzinger 05ff98103f Remove dead code in pyproject_requirements_txt.py
This removes some code from pyproject_requirements_txt.py that serves no
purpose (assigns to a variable that is never used).

Related: rhbz#2168193
2023-02-13 16:42:58 +01:00