Commit Graph

72 Commits

Author SHA1 Message Date
Miro Hrončok
25646ef7c1 CI tests: Update setuptools_scm to fix FTBFS on rawhide 2021-11-29 16:52:09 +01:00
Miro Hrončok
d5f4f199b6 CI tests: Remove Fedora 33 compatibility shims, as F33 reaches EOL 2021-11-29 15:12:43 +01:00
Karolina Surma
c1baa534b6 Introduce %%pyproject_check_import
%%pyproject_save_files newly saves also a list of importable modules.
The list is used by %%pyproject_check_import to invoke the import test
on each module name.
%%pyproject_check_import accepts two options:
-t: filter only top-level modules
-e: exclude module names matching the given glob from the import check
2021-10-29 08:40:42 +02:00
Miro Hrončok
cefe82ed0d CI: Update the dns-lexiocn package so it also builds on Fedora 36+ 2021-10-25 16:24:32 +02:00
Miro Hrončok
6bbba680f4 Fedora CI: Update pytest so it still builds on Fedora 36 with pluggy 1.0 2021-09-09 12:12:13 +02:00
Tomas Hrnciar
5169e0e340 Automatically detect LICENSE files and mark them with %license macro 2021-07-23 13:30:43 +02:00
Miro Hrončok
8588098b34 Rename %_pyproject_ghost_distinfo and %_pyproject_record to indicate they are private 2021-07-23 10:01:13 +02:00
Miro Hrončok
f8a3343abc %pyproject_buildrequires now fails when it encounters an invalid requirement
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1983053
2021-07-23 10:00:01 +02:00
Miro Hrončok
49b58d7869 CI tests: Skip failing tests of python-httpbin
The tests are failing on Fedora 35+ for reasons beyond pyproject-rpm-macros.
2021-07-17 00:29:04 +02:00
Miro Hrončok
d204ac14cd Escape weird paths generated by %pyproject_save_files 2021-07-13 11:29:19 +02:00
Miro Hrončok
639beeeaac CI tests: Update pytest's patch for Python 3.10.0b4+ 2021-07-13 01:29:48 +02:00
Tomas Hrnciar
d6ad9a778a Generate BuildRequires from file
%pyproject_buildrequires macro now accepts multiple file names to load
additional dependencies from them.

New option -N was added to disable automatical generation of requirements
in case package does not use build system. Option -N cannot be used in
combination with options -r, -e, -t, -x.

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2021-07-08 13:08:04 +02:00
Miro Hrončok
5470f5688e Avoid leaking %{_pyproject_builddir} to pytest collection
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1935212

Requires a %pytest change: https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/102
2021-06-28 14:07:29 +02:00
Miro Hrončok
46e4eb4bcd CI tests: Make python-pytest.spec build with Python 3.10+
Preserve compatibility with Fedora 33.
2021-06-17 13:08:36 +02:00
Miro Hrončok
29157c19b0 Set %_pyproject_wheeldir and %_pyproject_builddir relative to the source tree, not $PWD
This allows users to do:

    %build
    cd somewhere
    %pyproject_wheel
    cd -
    cd somewhere_else
    %pyproject_wheel
    cd -

    %install
    %pyproject_install

Without a need to copy paste the wheels to a common location.

This is in fact a breaking change, I'll make sure to adapt the affected packages in Fedora.
2021-05-27 21:28:01 +02:00
Miro Hrončok
c95238388a Don't leak $TMPDIR outside of pyproject macros
During %install, the BRB scripts might be affected by it
2021-05-27 21:28:01 +02:00
Miro Hrončok
c0c09a476a Cleanup the tests (and docs) for Fedora 32 EOL 2021-05-27 21:27:39 +02:00
Miro Hrončok
11021cf250 CI: Update requests version to work with chardet 4 (needed for Fedora 34+) 2021-02-07 21:26:32 +01:00
Miro Hrončok
cc5688e49d Include nested __pycache__ directories in %pyproject_save_files 2021-02-07 20:05:47 +01:00
Miro Hrončok
26bb3cb4d1 Tests: Update setuptools_scm to fix a problem with pytest 6.2 2021-02-04 12:41:09 +01:00
Miro Hrončok
d8b6408932 %pyproject_save_files: List all files from RECORD and their %dirs
This is done to avoid troubles with %lang files listed as duplicated.

 1. It gets rid of a warning
 2. It fixes a problem described in:
    http://lists.rpm.org/pipermail/rpm-list/2020-November/002041.html

This is a backwards incompatible change,
packages that rename or remove the installed files after %pyproject_install
might no longer be compatible with %pyproject_save_files.
2021-01-11 15:14:21 +01:00
Miro Hrončok
8a31feb8e1 CI: Allow passing extra arguments to mocktest.sh 2021-01-08 23:45:30 +01:00
Miro Hrončok
76613bd4a7 CI mock: Attempt to retry package manager action
This should be more robust when hitting:

 Errors during downloading metadata for repository 'local':
   - Status code: 404 for https://kojipkgs.fedoraproject.org/repos/rawhide/latest/x86_64/repodata/...-primary.xml.gz
   - Status code: 404 for https://kojipkgs.fedoraproject.org/repos/rawhide/latest/x86_64/repodata/...-filelists.xml.gz
2021-01-08 14:52:06 +01:00
Miro Hrončok
03fa61b26b CI: Upgrade dns-lexicon to 3.5.2, but only on Fedora 34+ 2020-12-04 10:50:59 +01:00
Miro Hrončok
38ef5fb85b Allow multiple -e in %pyproject_buildrequires 2020-11-04 18:35:22 +01:00
Miro Hrončok
2660031756 CI tests: Use ! grep to assert something is missing
Previously, we have used `grep -v` to assert something is *not* there.
However, that doesn't work. See for example this file:

    $ cat TEST
    line1
    line2
    line3

    $ grep -v line4 TEST
    line1
    line2
    line3
    $ echo $?
    0

This gives a false sense of correctness, however it exits will 0 with anything:

    $ grep -v line3 TEST
    line1
    line2
    $ echo $?
    0

Instead, we use `! grep` now:

    $ ! grep line4 TEST
    $ echo $?
    0

    $ ! grep line3 TEST
    line3
    $ echo $?
    1

Additionally, remove a trailing slash from one of the checks to match both cases
(with or without the slash).
2020-10-26 17:18:51 +01:00
Miro Hrončok
e9281281f6 BR python3-devel from the test/example specs
This is the usage we want people to see.
One spec left with a comment instead.
2020-10-26 16:11:32 +01:00
Miro Hrončok
57e1b00844 CI tests: Workaround old pip missing features in testing specs 2020-10-07 14:27:57 +02:00
Miro Hrončok
290941c5f3 Support PEP 517 list based backend-path
The PEP 517 shows an example backend-path like this:

    [build-system]
    # Defined by PEP 518:
    requires = ["flit"]
    # Defined by this PEP:
    build-backend = "local_backend"
    backend-path = ["backend"]

https://www.python.org/dev/peps/pep-0517/#source-trees

See that backend-path is a list. Our code previously only supported string path.

Obviously a string path is wrong, but we keep it to support projects that have
made the mistake, such as flit-core.

Add a small integration test for both cases.
Note that the new spec files deliberately don't do much, to save CI time.
2020-10-07 08:35:45 +02:00
Miro Hrončok
6ae1be028b Fix typos 2020-10-01 18:08:06 +02:00
Miro Hrončok
b38c0ff594 CI: Add dns-lexicon to tests new things
This tests:

- https://bugzilla.redhat.com/show_bug.cgi?id=1877977
- https://bugzilla.redhat.com/show_bug.cgi?id=1877978

Unfortunately it is impossible to use this spec to test things on Fedora 31/32,
so we skip the tests there.

We keep python-requests.spec for now to test Fedora 31/32,
but it can be removed after Fedora 32 EOL.
2020-10-01 16:35:08 +02:00
Lumir Balhar
0498ef29dd Improve grep regex for RECORD and REQUESTED files 2020-10-01 09:28:21 +02:00
Lumir Balhar
052c239cab Modify clikit to not use %pyproject_save_files and add check there 2020-10-01 09:28:21 +02:00
Lumir Balhar
595fc3b049 Add check for RECORD and REQUESTED files 2020-10-01 09:28:21 +02:00
Miro Hrončok
b1f03d7f51 Add integration test for package with setuptools setup_requires 2020-09-23 11:43:35 +02:00
Tomas Hrnciar
d754bc75b9 Test for package with lang files located outside of module 2020-09-04 10:39:52 +02:00
Tomas Hrnciar
da3d9bc23d Automatically mark language files with %lang macro 2020-09-04 10:39:52 +02:00
Miro Hrončok
a613e176e3 Handle Python Extras in %pyproject_buildrequires on Fedora 33+
There is a slight problem when reporting that a dependency with extra is satisfied.
In fact, we only check the "base" dependency.
This can lead to a problem when a dependency is wrongly assumed as present
and the script proceeds to the "next stage" without restarting --
if the next stage tries to use (import) the missing dependency,
the script would crash.

However, that might be a very unlikely set of events and if such case ever happens,
we'll workaround it or fix it.
2020-08-20 15:30:49 +02:00
Miro Hrončok
6a8d86ed70 Allow multiple, comma-separated extras in %pyproject_buildrequires -x 2020-08-11 15:54:42 +02:00
Miro Hrončok
99d9596d7c Make sure to put * in '' in %pyproject_save_files
Otherwise, it may be expanded by Shell in random cases.
2020-08-06 20:19:40 +02:00
Tomas Hrnciar
bd0f6049de Update test yaml with newly added specs 2020-08-06 15:26:37 +02:00
Tomas Hrnciar
5809bbc77e Replace +bindir with +auto in README and spec files 2020-08-06 15:26:37 +02:00
Tomas Hrnciar
d0d4060cec Add test for +auto argument to include .pth files in other files 2020-08-06 15:26:37 +02:00
Tomas Hrnciar
0db4e67f03 Add test for +auto argument to include data files in other files 2020-08-06 15:26:37 +02:00
Miro Hrončok
cb4e43c670 Implement %pyproject_extras_subpkg 2020-07-29 17:40:37 +02:00
Miro Hrončok
a723865460 Remove Fedora 30 remnants 2020-06-23 11:09:03 +00:00
Petr Viktorin
9789724e07 Update python-ldap.spec to fix build failure
Use release 0 to not conflict with Fedora.
2020-06-23 11:04:38 +00:00
Tomas Hrnciar
19f84b1f4c Adapt pyproject_install macro to PEP 610
With changes in PEP 610 there is new file direct_url.json created, since it is not useful
for us we prevent it's creation. This commit changes %pyproject_install macro to install wheel using
name instead of path.

This commit also includes new test to check if file direct_url.json wasn't created.

https://discuss.python.org/t/pep-610-usage-guidelines-for-linux-distributions/4012
2020-05-07 13:08:22 +02:00
Miro Hrončok
95ba8376f5 Handle extracting debuginfo from extension modules
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1806625

Upstream issue for a proper fix https://github.com/pypa/pip/issues/7555

Co-Authored-By: Petr Viktorin <pviktori@redhat.com>
2020-04-16 15:45:48 +02:00
Patrik Kopkan
2800b49530 Add %pyproject_save_files macro
This macro save generates file section to %pyproject_files. It should
simplify %files section and allow to build by some automatic machinery

Supposed use case in Fedora:
    %install
    %pyproject_install
    %pyproject_save_files requests _requests

    %files -n python3-requests -f %{pyproject_files}
    %doc README.rst
    %license LICENSE

Automatic build of arbitrary packages (e.g. in Copr):
    %install
    %pyproject_install
    %pyproject_save_files * +bindir // save all modules with executables

    %files -n python3-requests -f %{pyproject_files}

Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
2020-04-15 16:45:10 +02:00