Commit Graph

238 Commits

Author SHA1 Message Date
Miro Hrončok
7e1a8fd079 Handle tox provision (tox.requires / tox.minversion) 2021-04-07 16:01:33 +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
ff396611dd Generate python3dist(setuptools/wheel) BuildRequires directly from the macro
The macro already checks if pyproject.toml exists and echoes the dependency
on python3dist(toml) early. This adds an else branch to echo the default backend.

For projects without pyproject.toml, the number of installation rounds
is reduced. Previously:

 1. (python3-devel +) pip + packaging
 2. setuptools + wheel
 3. ...

Now:

 1. (python3-devel +) pip + packaging + setuptools + wheel
 2. ...

This duplicates the information about the default build backend,
because the script still needs to handle projects with pyproject.toml without
an explicit build backend option.
Hence, the script was not adapted (except a comment).
2021-02-03 12:00:58 +01:00
Miro Hrončok
06b21e1976 Generate python3dist(toml) BuildRequires directly from the macro
The macro checks if pyproject.toml exists and echoes the dependency early.

For projects with pyproject.toml, this saves one installation round.
Previously, the installation steps by %generate_buildrequires were:

 1. (python3-devel +) pip + packaging
 2. toml
 3. parsed dependencies from pyproject.toml
 4. ...

Now they are:

 1. (python3-devel +) pip + packaging + toml
 2. parsed dependencies from pyproject.toml
 3. ...

For projects without pyproject.toml, the number of rounds remains the same:

 1. (python3-devel +) pip + packaging
 2. setuptools + wheel
 3. ...

This is also more consistent:
The Python script now only outputs dependencies of the probed project,
it no longer partially outputs dependencies for itself.
2021-02-03 12:00:58 +01:00
Miro Hrončok
390b9713aa Remove support for Python 3.7 from %pyproject_buildrequires
Fedora 31 is EOL and was the last one with Python 3.7 packages.
EL 8 has Python 3.6 but doesn'T have %generate_buildrequires.
2021-02-03 12:00:58 +01:00
Fedora Release Engineering
59d092e9dd - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-27 08:56:41 +00:00
Miro Hrončok
7d98feee23 Update the description of the package to match the new README content
https://bugzilla.redhat.com/show_bug.cgi?id=1914450#c5
2021-01-15 18:47:11 +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
32790fff20 Pass PYTHONDONTWRITEBYTECODE=1 to %tox to avoid packaged PYTEST bytecode 2020-12-04 10:50:58 +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
Petr Viktorin
6a44fe2d7a Fix name of option that redefines %{toxenv} 2020-10-08 17:55:43 +02: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
Petr Viktorin
d719a00b93 Document %pyproject_extras_subpkg 2020-10-02 20:57:26 +00:00
Miro Hrončok
ea43eebba6 Document %pyproject_buildrequires -x a -x b 2020-10-01 19:25:55 +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
Miro Hrončok
6f6a7636d4 Skip empty lines from tox deps
An empty line happens when there are not deps:

    Handling  from tox --print-deps-only: <toxname>
    WARNING: Skipping invalid requirement:
        Parse error at "''": Expected W:(abcd...)
2020-10-01 16:35:08 +02:00
Miro Hrončok
2ecbed7441 Support multiple -x options for %pyproject_buildrequires
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1877978
2020-10-01 16:35:07 +02:00
Miro Hrončok
9f3eea2ae5 Support the extras configuration option of tox in %pyproject_buildrequires -t
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1877977
2020-10-01 16:33:58 +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
faa42c8681 Release bump and changelog 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
Lumir Balhar
c5d2f62b23 Use --verbose and --force when removing RECORD and REQUESTED files 2020-10-01 09:28:21 +02:00
Lumir Balhar
efdfb4727f Automatically remove dist-info/REQUESTED files together with RECORD 2020-10-01 09:28:21 +02:00
Lumir Balhar
7cc563401d [TESTS] Adap tests to new process of handling RECORD files 2020-09-25 12:24:50 +00:00
Lumir Balhar
228f3947df [TESTS] parse_record returns a list of strings instead of BuildrootPaths
Because the output is directly stored to JSON file.
2020-09-25 12:24:50 +00:00
Lumir Balhar
a5cf74fc41 [TESTS] dist-info/RECORD file is no longer present in RPMs
%pyproject_install deletes it after conversion to pyproject-record
2020-09-25 12:24:50 +00:00
Lumir Balhar
8d5b3ac22f Restructure %pyproject_install to remove duplicated for loop 2020-09-25 12:24:50 +00:00
Lumir Balhar
894e21291e Preprocess dist-info/RECORD file in %install and remove it.
According to PEP 627, the RECORD file is optional and
doesn't make sense to keep it for system packages. Moreover,
its absence should indicate to other tools like pip that
they should not touch such packages.

Now, we process content of all RECORD files to one
pyproject-record (JSON) which is then used in
%pyproject_save_files. That way, we can remove the original
files in %pyproject_install and keep their content for
later.

PEP 627: https://www.python.org/dev/peps/pep-0627/#optional-record-file
2020-09-25 12:24:50 +00:00
Miro Hrončok
b1f03d7f51 Add integration test for package with setuptools setup_requires 2020-09-23 11:43:35 +02:00
Miro Hrončok
3b95c7d66c Check the requirements after installing "requires_for_build_wheel"
If not checked, installing runtime requirements might fail.

When a requirement is specified in setuptools' setup_requires:

    setup(
        ...
        setup_requires=["pytest-runner"],
    )

It is part of the get_requires_for_build_wheel hook output.

When runtime requirements are parsed with setuptools without all setup_requires
present, it tries to get them from the internet (at least on Fedora 33).

By checking the requirements after installing "requires_for_build_wheel",
we make sure all setup_requires are already installed.

When runtime requirements are not installed, this adds an unneeded check,
but the script would end at that point anyway, so there is no real difference.
2020-09-23 11:16:41 +02:00
Miro Hrončok
c4743014ca Changelog dates corrections 2020-09-12 09:53:24 +02:00
Gordon Messmer
cb38f210d2 Support more Python version specifiers in generated BuildRequires
This change introduces code from pyreq2rpm, a tested set of
requirement conversion functions used in pyp2rpm and rpm's
pythondistdeps.

This adds support for the '~=' operator and wildcards.
2020-09-12 01:09:48 +02:00
Miro Hrončok
b2b33b8a0b Remove superfluous executable permissions 2020-09-09 09:58:34 +02:00
Miro Hrončok
80a2764884 Remove a no longer useful warning for unrecognized files in %pyproject_save_files
The warning is not actionable and with +auto even redundant.
2020-09-07 11:44:48 +02:00
Miro Hrončok
c1d5d64f8c Prevent "File listed twice" warning with %lang files outside of Python modules 2020-09-07 09:42:33 +00:00
Miro Hrončok
b4fd1c2e74 Only require toml for projects with pyproject.toml
Pros:

 - projects without pyproject.toml will have 1 less dependency
 - toml will be buildable with pyproject-rpm-macros out of the box
 - easier bootstrap sequence (in theory)

Cons:

 - projects with pyproject.toml will have 1 more %generate_buildrequires round
2020-09-07 09:48:27 +02:00
Miro Hrončok
1e199ca6f4 Make code in $PWD importable from %pyproject_buildrequires
In %pyproject_buildrequires, don't run python with -I but -s.

This allows projects used by the script itself, such as packaging or toml,
to be packaged using the macros, using "self" -- i.e. the code from $PWD.
2020-09-04 21:47:35 +00:00
Tomas Hrnciar
a506123afe Replace pathfix with py3_shebang_fix
%pyproject_install currently has:
`pathfix%{python3_version}.py -pni "%{__python3}" -k%{?py3_shbang_opts: -a%{py3_shbang_opts_nodash}} %{buildroot}%{_bindir}/*`

We should replace it with `%py3_shebang_fix %{buildroot}%{_bindir}/*` which expands to:
~~~~
  if [ -f /usr/bin/pathfix%{python3_version}.py ]; then
    pathfix=/usr/bin/pathfix%{python3_version}.py
  else
    # older versions of Python don't have it and must BR /usr/bin/pathfix.py from python3-devel explicitly
    pathfix=/usr/bin/pathfix.py
  fi
  $pathfix -pni %{__python3} -k%{?py3_shebang_flags:a %py3_shebang_flags}} %{buildroot}%{_bindir}/*
~~~~

Mainly so that we:
 - switch to %py3_shebang_flags
 - have only one place to fix the invocation

Fixes: rhbz#1868347
2020-09-04 18:24:30 +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