Commit Graph

21 Commits

Author SHA1 Message Date
Tomas Orsava
438d8d3b70 scripts/pythondistdeps: Backport switch to importlib.metadata from upstream
Upstream change to importlib.metadata: https://github.com/rpm-software-management/rpm/pull/1317

Due to extras packages being hadled slightly differently by importlib,
one test case for this was added.  And due to changes in handling
requires.txt files, comments were removed from the pyreq2rpm.tests
testing package.

Also because of the switch, we removed the dependency on setuptools and
added a dependency on packaging.

Note: Some packages with egg-info files might provide a different name
due to this change if there is a conflict between the filename and the
name in the metadata. Previously, the filename was sometimes used to
parse the name, now it is always the content of that file, which is what
packaging does, and thus also pip and other Python tooling. Currently,
this is known to affect only 1 package in Fedora (ntpsec).

The resulting script is different from upstream because of not yet upstreamed changes in Fedora:
- scripts/pythondistdeps: Rework error messages
- scripts/pythondistdeps: Add parameter --package-name
- scripts/pythondistdeps: Implement provides/requires for extras packages
- pythondistdeps.py: When parsing extras name, take the rightmost +

These changes are proposed in this upstream PR: https://github.com/rpm-software-management/rpm/pull/1546
2021-02-18 16:08:27 +01:00
Miro Hrončok
bfb7f70b99 Add a test for a requires with multiple underscores 2020-09-25 14:22:03 +02:00
Tomas Orsava
cb3aaf6d26 Add a test for a requires with an underscore
We already have PyQt5_sip as a test of a provides with an underscore
2020-09-23 11:39:53 +02:00
Tomas Orsava
64e5d7567a Sync tests for python dependency conversion with pyreq2rpm 2020-07-22 18:00:02 +02:00
Tomas Orsava
32a1b47f5b scripts/pythondistdeps: Tests: small tweaks 2020-07-10 15:46:19 +02:00
Tomas Orsava
c2e0f33565 scripts/pythondistdeps: Add tests for: Rework error messages 2020-07-10 15:37:11 +02:00
Tomas Orsava
9df3e5bcb5 scripts/pythondistdeps: Add tests for: Implement provides/requires for extras packages 2020-07-10 13:42:12 +02:00
Miro Hrončok
48c0de39d9 Add a script to generate Python bundled provides
See https://src.fedoraproject.org/rpms/python-setuptools/pull-request/40

Strictly speaking, this is not an RPM generator, but:

 - it generates provides
 - it is tighly coupled with pythondistdeps.py

Usage:

 1. Run `$ /usr/lib/rpm/pythonbundles.py .../vendored.txt`

 2. Copy the output into the spec as a macro definition:

    %global bundled %{expand:
    Provides: bundled(python3dist(appdirs)) = 1.4.3
    Provides: bundled(python3dist(packaging)) = 16.8
    Provides: bundled(python3dist(pyparsing)) = 2.2.1
    Provides: bundled(python3dist(six)) = 1.15
    }

 3. Use the macro to expand the provides
 4. Verify the macro contents in %check:

    %check
    ...
    %{_rpmconfigdir}/pythonbundles.py src/_vendor/vendored.txt --compare-with '%{bundled}'
2020-07-07 16:01:37 +02:00
Miro Hrončok
3a396fbf96 Use PEP 503 names for requires 2020-05-21 17:43:19 +02:00
Miro Hrončok
39315a6aa4 Adapt tests for the pythonXY -> pythonX.Y renaming
See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/message/VIUS7WMQMDX6H2WEIH7TVTMBB6SUHY7E/
2020-05-07 17:59:18 +02:00
Miro Hrončok
33358b9a65 Deduplicate automatically provided names trough Python RPM Lua macros 2020-05-05 14:02:52 +02:00
Miro Hrončok
c3f90ed2e8 Fix reversed grep exit codes in integration tests
grep -v only fails if there are no unmatched lines, but that's not what we want to test.
2020-05-04 13:45:57 +02:00
Miro Hrončok
6beec97e9e Add integartion test for the dist generator 2020-05-04 13:45:57 +02:00
Tomas Orsava
54e4aa751b Bump version, enable new features, add test suite to Fedora CI 2020-05-04 13:45:57 +02:00
Tomas Orsava
79790d12af scripts/pythondistdeps: Modify handling of dev versions 2020-04-30 22:24:44 +02:00
Tomas Orsava
1523def34e scripts/pythondistdeps: Implement --normalized-name-* options
--normalized-names-format FORMAT
    FORMAT of normalized names can be `pep503` [default] or `legacy-dots` (dots allowed)

--normalized-names-provide-both
    Provede both `pep503` and `legacy-dots` format of normalized names (useful for a transition period)
2020-04-30 22:24:44 +02:00
Tomas Orsava
e33d4e94c8 scripts/pythondistdeps: Add option to generate major-version provides only for specified Python versions 2020-04-30 22:24:44 +02:00
Tomas Orsava
89e1676cee scripts/pythondistdeps: Add tests
The test data download themselves using pip if not present
2020-04-30 22:24:44 +02:00
Miro Hrončok
8eef42cbaa Use dynamic %_prefix value when matching files for python(abi) provides
See https://lists.fedoraproject.org/archives/list/packaging@lists.fedoraproject.org/thread/UFKUM5UKCTNGIT3KJVYEI5VXPI23QMBN/

Flatpak builds redefine %_prefix and the dependencies should remain present.

Also get rid of one useless ^ and prep the pattern for two digit Python major versions.

Add a test that tests that we match our default %_prefix (was the case even before this commit).
2020-04-07 16:25:11 +02:00
Miro Hrončok
bbfe4930d9 Automatically call %python_provide
This allows us to drop the %python_provide macro from most spec files,
except where we want to use it for virtual provides or empty packages.
2020-04-03 16:06:46 +02:00
Miro Hrončok
eae8dd0f57 Add CI tests for python(abi) provides 2020-04-03 14:35:16 +02:00