Commit Graph

107 Commits

Author SHA1 Message Date
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
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
Petr Viktorin
91acc88e2d Make %{_pyproject_wheeldir} an implementation detail 2020-08-20 12:02:34 +02:00
Petr Viktorin
fb4066b150 Update README
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1868346

- Explain what "provisional" means
- Say what kinds of projects the macros handle
- Tell people to BuidRequire python*-devel
- Say %pyproject_buildrequires is needed for the other macros
- Note that %pyproject_buildrequires generates `exit 11` messages
- Note that most buildsystems have prepare-metadata-for-build-wheel
2020-08-20 12:00:28 +02:00
Petr Viktorin
09be4c117d Typo fix 2020-08-20 11:48:14 +02:00
Miro Hrončok
6a8d86ed70 Allow multiple, comma-separated extras in %pyproject_buildrequires -x 2020-08-11 15:54:42 +02:00
Lumir Balhar
59bc07b713 Release bump and changelog for universal macros 2020-08-10 12:05:45 +02:00
Lumir Balhar
cb8e334272 Use python -m tox instead of just tox
This way, macros can use whatever Python has tox module available
instead of only the main one which owns /usr/bin/tox.
2020-08-10 12:04:22 +02:00
Lumir Balhar
5561755a00 Make %pyproject_buildrequires more universal
so it can work with any non-main Python version and generate
proper dependencies.
2020-08-10 12:04:22 +02:00
Lumir Balhar
64e45518ef Use versioned pathfixX.Y.py script
so pyproject-rpm-macros can depend on any pythonX.Y-devel package
2020-08-10 12:04:22 +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
1fc1c18fd9 Removes bindir parameter from script
This parameter is not necessary anymore with +auto argument replacing +bindir.
2020-08-06 15:26:37 +02:00
Tomas Hrnciar
c1249414d6 Add definition for DATADIR 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
Tomas Hrnciar
0259b46867 Remove todo comment about .pth files
WRT to addition of +auto argument, all .pth files should be classified
as other files.
2020-08-06 15:26:37 +02:00
Tomas Hrnciar
91c8c27c63 Remove unused "executables" section from script and test data 2020-08-06 15:26:37 +02:00
Tomas Hrnciar
e2c64e79a0 Modify tests to accept all unclassified files in others. 2020-08-06 15:26:37 +02:00
Tomas Hrnciar
79678f7e72 Replace +bindir argument with +auto to include all unclassified files to
filelist.
2020-08-06 15:26:37 +02:00
Miro Hrončok
7e5adc9c02 Fix a copy paste error in %pyproject_extras_subpkg definition
Also, add a comment for unreadable RPM expression.

This is a fixup of cb4e43c670
2020-08-04 15:17:16 +02:00
Miro Hrončok
cb4e43c670 Implement %pyproject_extras_subpkg 2020-07-29 17:40:37 +02:00
Fedora Release Engineering
26607dc0db - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-28 23:22:27 +00:00
Miro Hrončok
262f6d3bc3 %pyproject_buildrequires -x now implies -r
The usage without -r errored anyway, this way instead of forcing the user to add it,
we do it ourselves.

Machines stealing human's labor, yet again.
2020-07-16 13:38:50 +02:00
Miro Hrončok
37216e779e Set HOSTNAME to prevent tox 3.17+ from a DNS query
Tox calls socket.getfqdn() and that call does a DNS query.
In mock with disabled networking, it takes a minute until that times out.
When a spec file uses %pyproject_buildrequires -t and %tox, it is a 3 minute delay.

Since 3.17, tox does not call socket.getfqdn() when HOSTNAME variable is set to a value:

https://github.com/tox-dev/tox/pull/1616

The value is only used in result log, so setting it to "rpmbuild"
actually makes the logs more reproducible as well.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1856356
when tox is used in %pyproject_buildrequires -t or %tox.
2020-07-15 13:24:40 +02:00
Miro Hrončok
a723865460 Remove Fedora 30 remnants 2020-06-23 11:09:03 +00:00
Miro Hrončok
ed5dd772f3 Switch from upstream deprecated pytoml to toml 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
Petr Viktorin
82a7579530 Document how to test the macros 2020-06-23 11:48:59 +02: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