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.
This commit is contained in:
Miro Hrončok 2020-09-23 11:10:30 +02:00
parent c4743014ca
commit 3b95c7d66c
2 changed files with 6 additions and 1 deletions

View File

@ -6,7 +6,7 @@ License: MIT
# Keep the version at zero and increment only release
Version: 0
Release: 28%{?dist}
Release: 29%{?dist}
# Macro files
Source001: macros.pyproject
@ -91,6 +91,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
%license LICENSE
%changelog
* Wed Sep 23 2020 Miro Hrončok <mhroncok@redhat.com> - 0-29
- Check the requirements after installing "requires_for_build_wheel"
- If not checked, installing runtime requirements might fail
* Tue Sep 08 2020 Gordon Messmer <gordon.messmer@gmail.com> - 0-28
- Support more Python version specifiers in generated BuildRequires
- This adds support for the '~=' operator and wildcards

View File

@ -193,6 +193,7 @@ def generate_build_requirements(backend, requirements):
with hook_call():
new_reqs = get_requires()
requirements.extend(new_reqs, source='get_requires_for_build_wheel')
requirements.check(source='get_requires_for_build_wheel')
def generate_run_requirements(backend, requirements):