#414 Fix handling of tox 4 provision without tox minversion
Merged 9 months ago by churchyard. Opened 9 months ago by churchyard.
rpms/ churchyard/pyproject-rpm-macros minversion-none  into  rawhide

file modified
+3 -1
@@ -171,8 +171,10 @@ 

  

  

  %changelog

- * Wed Sep 13 2023 Karolina Surma <ksurma@redhat.com> - 1.10.0-1

+ * Wed Sep 13 2023 Python Maint <python-maint@redhat.com> - 1.10.0-1

  - Add %%_pyproject_check_import_allow_no_modules for automated environments

+ - Fix handling of tox 4 provision without and explicit tox minversion

+ - Fixes: rhbz#2240590

  

  * Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.0-2

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

file modified
+1 -1
@@ -386,7 +386,7 @@ 

          provision_content = provision.read()

          if provision_content and r.returncode != 0:

              provision_requires = json.loads(provision_content)

-             if 'minversion' in provision_requires:

+             if provision_requires.get('minversion') is not None:

                  requirements.add(f'tox >= {provision_requires["minversion"]}',

                                   source='tox provision (minversion)')

              if 'requires' in provision_requires:

@@ -589,6 +589,43 @@ 

        python3dist(inst)

    result: 0

  

+ tox provision no minversion:

+   installed:

+     setuptools: 50

+     wheel: 1

+     tox: 3.5.3

+     tox-current-env: 0.0.6

+   toxenv:

+     - py3

+   setup.py: |

+     from setuptools import setup

+     setup(

+         name='test',

+         version='0.1',

+     )

+   tox.ini: |

+     [tox]

+     requires =

+         setuptools > 40

+         wheel > 2

+   expected:

+     - |  # tox 3

+       python3dist(setuptools) >= 40.8

+       python3dist(wheel)

+       python3dist(wheel)

+       python3dist(tox-current-env) >= 0.0.6

+       python3dist(setuptools) > 40.0

+       python3dist(wheel) > 2.0

+     - |  # tox 4

+       python3dist(setuptools) >= 40.8

+       python3dist(wheel)

+       python3dist(wheel)

+       python3dist(tox-current-env) >= 0.0.6

+       python3dist(setuptools) > 40.0

+       python3dist(wheel) > 2.0

+       python3dist(tox)

+   result: 0

+ 

  Default build system, unmet deps in requirements file:

    installed:

      setuptools: 50

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2240590

The added test actually blows up without the fix with both tox 4 or tox 3,
so perhaps this bug also existed with tox 3.

rebased onto 51ddebfdb3f7fd1606b0218c21db2ad21fd23aab

9 months ago

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/7bfc98541632472b8f50088e7f7c53ca

rebased onto 88318e94b76ee682c8cbbcce349d63bc5a8439d9

9 months ago

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/0faa72a9c38d4bf191e0560bb1b68b15

rebased onto 2c1560a6a2d7beda6065e09c1a68cc5ae606d7ca

9 months ago

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/bbd1c62b8d204f13aa7b69d4c9c12f5e

The fix itself is trivial and I verified the test actually tests the fix (fails with the current version of pyproject-rpm-macros).
If I was extremely nitpicky, the quotation marks around minversion are now double and used to be single which is a (not totally consistent) preference in this file.

  • [x] PR solves the issue it claims to address (solves a bug)
  • [x] Resulting RPM package is installable on the destination Fedora release
  • [x] No dependent RPM packages will stop being installable when the PR is merged and built
  • [x] PR is tested sufficiently and the test results are OK (green CI, test added)
  • [x] PR is open against all relevant Fedora releases
  • [x] (If PR is open against more Fedora releases) branches don't diverge unnecessarily - the same commit hash for all of them
  • [x] (If PR is open against older Fedora releases) PR doesn't contain backwards incompatible changes
  • [x] Each commit's scope is sane (there are no irrelevant changes combined together)
  • [x] Each commit message is relevant
  • [x] (If it's linked), the right (problem, product) BZ ticket is referenced
  • [x] (If it's linked), BZ ticket reference is in the correct format in %changelog and/or commit message
  • [-] (If needed) Release is bumped
  • [-] (When adding patches) Patch purpose is documented in the specfile
  • [-] (When backporting patches) Patch origin and/or authorship is traceable
  • [-] (When creating patches from scratch) The patch is proposed upstream or justified as downstream-only

All good.

If I was extremely nitpicky, the quotation marks around minversion are now double and used to be single which is a (not totally consistent) preference in this file.

I actually copypasted the quotation marks form the line bellow, but let me keep them as they were.

rebased onto 089e251

9 months ago

Amended this:

diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py
index c575f61..7b0fc87 100644
--- a/pyproject_buildrequires.py
+++ b/pyproject_buildrequires.py
@@ -386,7 +386,7 @@ def generate_tox_requirements(toxenv, requirements):
         provision_content = provision.read()
         if provision_content and r.returncode != 0:
             provision_requires = json.loads(provision_content)
-            if provision_requires.get("minversion") is not None:
+            if provision_requires.get('minversion') is not None:
                 requirements.add(f'tox >= {provision_requires["minversion"]}',
                                  source='tox provision (minversion)')
             if 'requires' in provision_requires:

I now see the lien blow is in f-string, hence the different quotation marks were justified.

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/b8d22cb3538f41a6a13d52e652b320e3

Pull-Request has been merged by churchyard

9 months ago