Commit Graph

270 Commits

Author SHA1 Message Date
Carl George
a39d658f0f Fix PEP number typo 2023-09-25 16:32:54 -05:00
Miro Hrončok
4b32bbb939 Use %rpmversion to check if we are on RPM 4.19+ 2023-08-31 09:28:36 +00:00
Miro Hrončok
5ffc27bdf7 CI: Don't treat DeprecationWarnings in setuptools_scm's %check as errors 2023-08-30 23:11:42 +02:00
Miro Hrončok
0ae2849f20 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.
2023-08-30 23:07:40 +02:00
Miro Hrončok
479a6b3669 CI: Update poetry-core to workaround a weird FTBFS on Fedora 39+
This still builds on previous Fedoras and EPEL 9.
2023-08-30 22:40:37 +02:00
Miro Hrončok
9c358ccecb 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.
2023-08-30 22:23:25 +02:00
Miro Hrončok
3607591aa8 CI: Apply a FTBFS fix from Fedora 39 to the virtualenv spec 2023-08-30 22:00:18 +02:00
Miro Hrončok
3a8bea86f8 CI: Make pytest build on Fedora 37 to 39 as well as EPEL 9 2023-08-30 21:48:33 +02:00
Miro Hrončok
bd1022e422 CI: Run mock in verbose mode to see the logs 2023-08-21 22:41:19 +02:00
Fedora Release Engineering
53c81f57c1 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-21 06:47:19 +00:00
Miro Hrončok
4f16920edb CI: Adjust a couple of specs to allow Python 3.11 builds on RHEL 9
This allows running CI tests as:

    ./mocktest.sh python-isort --define 'python3_pkgversion 3.11'

Which only makes sense in RHEL, and hence is not done here.

The purpose of this change in Fedora is to make the test spec files identical to c9s,
for easier future synchronization.

Related c9s commit:
e8933acb12
2023-06-15 19:03:54 +02:00
Miro Hrončok
d14a2dbc54 Accept multiple values for the same config settings 2023-06-01 21:24:39 +02:00
590154b68c document config_settings support 2023-06-01 21:24:39 +02:00
1dd43533b8
buildrequires: make -C and -N mutually exclusive 2023-05-31 19:26:33 +00:00
156e2fc8fe
Allow passing config_settings to the build backend
Resolves: https://bugzilla.redhat.com/2192581
2023-05-31 19:26:32 +00:00
Miro Hrončok
638ba27daf 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.
2023-05-31 18:26:51 +02:00
Miro Hrončok
ca3771c78d 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.
2023-05-31 18:25:49 +02:00
Miro Hrončok
5ab7319ece Use tomli for older Pythons, now when RHEL 9 has it 2023-05-31 09:51:54 +02:00
Miro Hrončok
4a38795ceb CI: Make python-virtualenv.spec EL9-compatible
Related: rhbz#2208971
2023-05-30 13:11:13 +02:00
Miro Hrončok
efe31871f8 Make %pyproject_build_lib work with RPM 4.16
Related: rhbz#2208971
2023-05-30 11:25:32 +02:00
Miro Hrončok
161c16b15f
Bump the release for ELN dependency changes 2023-05-23 19:19:38 +00:00
Miro Hrončok
b05b7f600b
Don't run tox tests on RHEL by default, as tox is unwanted in RHEL
See https://github.com/fedora-eln/eln/issues/126
2023-05-23 19:19:38 +00:00
Miro Hrončok
193a077e5b
Use lowercase tox in test case names, as upstream wants it 2023-05-23 19:19:38 +00:00
aaac9203b9
don't use pytest-xdist in RHEL
Relates: https://github.com/fedora-eln/eln/issues/125
2023-05-23 19:19:38 +00:00
Miro Hrončok
17dab005cc In %check, assert the two signatures of %pyproject_buildrequires match exactly 2023-05-23 14:56:52 +02:00
Miro Hrončok
9d4e88e1a6 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
2023-04-27 18:45:43 +02:00
Miro Hrončok
bd7890110c %pyproject_buildrequires: Add support for self-referential extras requirements 2023-04-27 11:18:18 +02:00
Miro Hrončok
a5e7a3cd07 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/
2023-04-26 23:08:07 +02:00
Maxwell G
ef9a286793 Simplify assertion in tests 2023-04-17 15:32:31 +02:00
Miro Hrončok
456903666c 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.
2023-04-17 15:32:26 +02:00
Miro Hrončok
f8e160d767 Remove duplicate import 2023-03-31 18:59:06 +02:00
Miro Hrončok
19370fa8f0 Acknowledge the license is MIT even in SPDX
$ askalono identify LICENSE
    License: MIT (original text)
    Score: 1.000
2023-03-27 17:22:15 +02:00
Lumir Balhar
1e37a4d872 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.
2023-03-03 10:02:49 +01:00
Lumir Balhar
7ba21ea4a8 Improve detection of lang files 2023-02-09 11:01:23 +00:00
Miro Hrončok
7600d88d04 CI: Adjust spec conditionals for F35 EOL
Also, use %elif instead of a nested %if.
2023-02-07 16:37:33 +01:00
Miro Hrončok
d53d20c711 %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).
2023-02-06 22:26:02 +01:00
Miro Hrončok
85fc41174d %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.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2166888
2023-02-06 21:17:42 +01:00
Miro Hrončok
a4d05ba2c2 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.
2023-01-20 21:57:49 +01:00
Fedora Release Engineering
05aaf0674a Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-20 10:43:08 +00:00
Miro Hrončok
03e6d054b8 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.
2023-01-14 23:57:54 +01:00
Miro Hrončok
d311a522b7 CI: Adjust %toxenv tests for tox 4 2023-01-14 23:57:54 +01:00
Miro Hrončok
2c69069593 CI: Manually BR pkg_resources from dns-lexicon to fix FTBFS
setuptools (pkg_resources) were transitively pulled in by tox
2023-01-14 23:57:54 +01:00
Miro Hrončok
d06c69a096 Adjust %pyproject_buildrequires tests for tox 4
Fixes: https://bugzilla.redhat.com/2160687
2023-01-14 23:57:52 +01:00
Miro Hrončok
e5c4bb2455 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.
2023-01-09 17:27:31 +01:00
Ralf Ertzinger
25a125d3ac 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).
2023-01-01 17:50:30 +01:00
Miro Hrončok
f21e684a67 Use %py3_test_envvars in %tox when available
The new %py3_test_envvars macro was added
to remove duplication of environment variables used in %check.

We reuse it in %tox to gain support e.g. for PYTEST_XDIST_AUTO_NUM_WORKERS.

However, we keep support for platforms where the macro is not yet available,
not to be forced to backport %py3_test_envvars everywhere right away.

Technically, this should change little, but it sets CFLAGS and LDFLAGS now,
hence a new Y version.
2022-12-15 19:52:09 +01:00
Miro Hrončok
cb40ce3612 CI: Adjust setuptools versions to make the CI mockbuilds work on Fedora 36 and 38 2022-12-15 18:40:24 +01:00
Miro Hrončok
8b3af75e2f Reorder %pyproject_buildrequires arguments for a nicer usage string
Before:

    usage: %pyproject_buildrequires [-w] [-R] [-e TOXENVS] [-t] [-x EXTRAS] [-N] [REQUIREMENTS.TXT ...]

After:

    usage: %pyproject_buildrequires [-x EXTRAS] [-t] [-e TOXENVS] [-w] [-R] [-N] [REQUIREMENTS.TXT ...]

The order was determined as:

    0. suppressed options
    1. extras, the easiest way to specify test deps (x)
    2. tox related options (te)
    3. build wheel, as it is provisional (w)
    4. "disablers" (RN)
    5. varargs are always listed last

Previous order was pretty much random.
2022-10-12 14:47:59 +02:00
Miro Hrončok
222ec5f4f5 Make %pyproject_buildrequires and %pyproject_save_files argparser errors nicer to macro users
Before:

    %pyproject_buildrequires bogus_arg
    usage: pyproject_buildrequires.py [-h] [-r] [-w] [--wheeldir PATH] [-R]
                                      [-e TOXENVS] [-t] [-x EXTRAS]
                                      [--generate-extras] [-p PYTHON3_PKGVERSION]
                                      [-N]
                                      [requirement_files ...]
    pyproject_buildrequires.py: error: argument requirement_files: can't open 'bogus_arg': ...

    %pyproject_save_files
    ...
    usage: pyproject_save_files.py [-h] --output-files OUTPUT_FILES
                                   --output-modules OUTPUT_MODULES --buildroot
                                   BUILDROOT --sitelib SITELIB --sitearch SITEARCH
                                   --python-version PYTHON_VERSION
                                   --pyproject-record PYPROJECT_RECORD --prefix
                                   PREFIX
                                   varargs [varargs ...]
    pyproject_save_files.py: error: the following arguments are required: varargs

After:

    %pyproject_buildrequires bogus_arg
    usage: %pyproject_buildrequires [-w] [-R] [-e TOXENVS] [-t] [-x EXTRAS] [-N]
                                    [REQUIREMENTS.TXT ...]
    %pyproject_buildrequires: error: argument REQUIREMENTS.TXT: can't open 'bogus_arg': ...

    %pyproject_save_files
    ...
    usage: %pyproject_save_files MODULE_GLOB [MODULE_GLOB ...] [+auto]
    %pyproject_save_files: error: the following arguments are required: MODULE_GLOB
2022-10-12 14:47:54 +02:00
Karolina Surma
516e1511a7 Filter discovered modules to match the given %pyproject_save_files globs
When certain modules are deliberately not included into the built RPM,
they shouldn't be listed in the list of qualified module names which are
used by %pyproject_check_import to test importability of the
distribution.
Resolves: https://bugzilla.redhat.com/2127958
2022-10-03 13:22:48 +02:00