Bug 2240590
| Summary: | ValueError: Requirement 'tox >= None' from tox provision (minversion) is invalid. | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Miro Hrončok <mhroncok> |
| Component: | pyproject-rpm-macros | Assignee: | Miro Hrončok <mhroncok> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | gui1ty, maxwell, mhroncok, pviktori, python-packagers-sig |
| Target Milestone: | --- | Keywords: | Reopened |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | pyproject-rpm-macros-1.10.0-1.fc40 pyproject-rpm-macros-1.10.0-1.fc38 pyproject-rpm-macros-1.10.0-1.fc37 pyproject-rpm-macros-1.10.0-1.fc39 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-09-30 03:34:48 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
This fixes the problem:
- if 'minversion' in provision_requires:
+ if provision_requires.get("minversion") is not None:
Obviously, this also needs tests etc.
FEDORA-2023-bec0eb6622 has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-bec0eb6622 FEDORA-2023-bec0eb6622 has been pushed to the Fedora 40 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-2023-fce9985dc0 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-fce9985dc0 FEDORA-2023-1e499386d7 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-1e499386d7 FEDORA-2023-f292d597c2 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-f292d597c2 FEDORA-2023-fce9985dc0 has been pushed to the Fedora 37 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-fce9985dc0` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-fce9985dc0 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2023-1e499386d7 has been pushed to the Fedora 38 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-1e499386d7` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-1e499386d7 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2023-f292d597c2 has been pushed to the Fedora 39 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-f292d597c2` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-f292d597c2 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2023-1e499386d7 has been pushed to the Fedora 38 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-2023-fce9985dc0 has been pushed to the Fedora 37 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-2023-f292d597c2 has been pushed to the Fedora 39 stable repository. If problem still persists, please make note of it in this bug report. |
Consider the following spec: =============================== Name: minversion-none Version: 0 Release: 0 Summary: ... License: MIT BuildArch: noarch BuildRequires: python3-devel %description ... %prep touch setup.py cat > tox.ini << EOF [tox] requires = you-cant-have-this EOF %generate_buildrequires %pyproject_buildrequires -t =============================== Build it with pyproject-rpm-macros 1.9.0-2.fc39. You'll get: + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/pyproject-wheeldir --output /builddir/build/BUILD/minversion-none-0-0.x86_64-pyproject-buildrequires -t Handling setuptools >= 40.8 from default build backend Requirement satisfied: setuptools >= 40.8 (installed: setuptools 67.7.2) Handling wheel from default build backend Requirement satisfied: wheel (installed: wheel 0.40.0) Handling wheel from get_requires_for_build_wheel Requirement satisfied: wheel (installed: wheel 0.40.0) Handling tox-current-env >= 0.0.6 from tox itself Requirement satisfied: tox-current-env >= 0.0.6 (installed: tox-current-env 0.0.11) ROOT: HandledError| provisioning explicitly disabled within /usr/bin/python3, but is missing [requires (has)]: you-cant-have-this and wrote to /builddir/build/BUILD/.pyproject-builddir/tmpovnqr8qa Handling tox >= None from tox provision (minversion) Traceback (most recent call last): File "/usr/lib/python3.12/site-packages/packaging/requirements.py", line 35, in __init__ parsed = _parse_requirement(requirement_string) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/packaging/_parser.py", line 64, in parse_requirement return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/packaging/_parser.py", line 82, in _parse_requirement url, specifier, marker = _parse_requirement_details(tokenizer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/packaging/_parser.py", line 126, in _parse_requirement_details marker = _parse_requirement_marker( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/packaging/_parser.py", line 147, in _parse_requirement_marker tokenizer.raise_syntax_error( File "/usr/lib/python3.12/site-packages/packaging/_tokenizer.py", line 165, in raise_syntax_error raise ParserSyntaxError( packaging._tokenizer.ParserSyntaxError: Expected end or semicolon (after name and no valid version specifier) tox >= None ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 107, in add requirement = Requirement(requirement_str) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/packaging/requirements.py", line 37, in __init__ raise InvalidRequirement(str(e)) from e packaging.requirements.InvalidRequirement: Expected end or semicolon (after name and no valid version specifier) tox >= None ^ During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 555, in main generate_requires( File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 454, in generate_requires generate_tox_requirements(toxenv, requirements) File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 390, in generate_tox_requirements requirements.add(f'tox >= {provision_requires["minversion"]}', File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 113, in add raise ValueError(message) ValueError: Requirement 'tox >= None' from tox provision (minversion) is invalid. RPM build warnings: RPM build errors: error: Bad exit status from /var/tmp/rpm-tmp.rR8yiJ (%generate_buildrequires) This is caused by tox 4 incompatibility in pyproject_buildrequires.py We have: provision_requires = json.loads(provision_content) if 'minversion' in provision_requires: requirements.add(f'tox >= {provision_requires["minversion"]}', source='tox provision (minversion)') But tox 4 generates: { "minversion": null, "requires": [ "you-cant-have-this", "tox" ] } Hence we should update the conditional to check for non-None value. Reproducible: Always Steps to Reproduce: 1. Build the provided spec Actual Results: Build fails with invalid Python requirements: Requirement 'tox >= None' from tox provision (minversion) is invalid. Expected Results: Build fails with unmet RPM requirements: python3dist(you-cant-have-this)