diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 34c7f04..678eb60 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -12,7 +12,7 @@ License: MIT # In other cases, such as backports, increment the point # release. Version: 0 -Release: 47%{?dist} +Release: 48%{?dist} # Macro files Source001: macros.pyproject @@ -119,6 +119,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %license LICENSE %changelog +* Sat Oct 16 2021 Miro Hrončok - 0-48 +- %%pyproject_buildrequires: Accept installed pre-releases for all requirements + * Thu Sep 09 2021 Miro Hrončok - 0-47 - %%pyproject_save_files: Expand the namespace error message, also display it with / - %%pyproject_save_files: Add a workaround error for spaces and [brackets] diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index 3b51ba8..ba433b2 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -127,6 +127,11 @@ class Requirements: print_err(f'Ignoring alien requirement:', requirement_str) return + # We need to always accept pre-releases as satisfying the requirement + # Otherwise e.g. installed cffi version 1.15.0rc2 won't even satisfy the requirement for "cffi" + # https://bugzilla.redhat.com/show_bug.cgi?id=2014639#c3 + requirement.specifier.prereleases = True + try: # TODO: check if requirements with extras are satisfied installed = self.get_installed_version(requirement.name) diff --git a/pyproject_buildrequires_testcases.yaml b/pyproject_buildrequires_testcases.yaml index 6d98fcf..5b07ffa 100644 --- a/pyproject_buildrequires_testcases.yaml +++ b/pyproject_buildrequires_testcases.yaml @@ -716,3 +716,26 @@ Weird and complex requirements file: # but that's good enough: - "WARNING: Simplifying 'ugly@git+https://github.com/monty/spam.git@master#egg=ugly' to 'ugly'." result: 0 + + +Pre-releases are accepted: + installed: + setuptools: 50 + wheel: 1 + toml: 1 + cffi: 1.15.0rc2 + pyproject.toml: | + [build-system] + requires = [ + "setuptools", + "wheel", + "cffi", + ] + build-backend = "setuptools.build_meta" + expected: | + python3dist(setuptools) + python3dist(wheel) + python3dist(cffi) + python3dist(wheel) + stderr_contains: "Requirement satisfied: cffi" + result: 0