public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/pyproject-rpm-macros] rawhide: %pyproject_buildrequires: When multiple extras are missing from metadata, list them all (sorted)
@ 2026-11-30 23:16 
  0 siblings, 0 replies; only message in thread
From:  @ 2026-11-30 23:16 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/pyproject-rpm-macros
            Branch : rawhide
            Commit : 7130feaeae9e401c036479fe36d02fb79e029cd0
            Author : Miro Hrončok <miro@hroncok.cz>
            Date   : 2026-11-30T22:44:04+01:00
            Stats  : +35/-5 in 4 file(s)
            URL    : https://src.fedoraproject.org/rpms/pyproject-rpm-macros/c/7130feaeae9e401c036479fe36d02fb79e029cd0?branch=rawhide

            Log:
            %pyproject_buildrequires: When multiple extras are missing from metadata, list them all (sorted)

Previously, the errors would "randomly" change based on a set order.
This sorts the extras, so the output is more reproducible,
and also collects all the errors before raising the exception.

Assisted-By: Claude Sonnet 5.5

---
diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec
index be33b79..a69042f 100644
--- a/pyproject-rpm-macros.spec
+++ b/pyproject-rpm-macros.spec
@@ -187,6 +187,7 @@ export HOSTNAME="rpmbuild"  # to speedup tox in network-less mock, see rhbz#1856
 * Mon Nov 30 2026 Miro Hrončok <miro@hroncok.cz> - 1.24.1-1
 - Memoize the NVRA used in file paths to avoid subpackages with custom VR overriding it
 - When subpackages defined custom Version and/or Release value, the paths could change mid-specfile
+- %%pyproject_buildrequires: When multiple extras are missing from metadata, list them all (sorted)
 
 * Wed Sep 30 2026 Karolina Surma <ksurma@redhat.com> - 1.24.0-1
 - Add %%pyproject_verify_license to assert the spec License: tag matches

diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py
index 410109e..a9f3e55 100644
--- a/pyproject_buildrequires.py
+++ b/pyproject_buildrequires.py
@@ -706,7 +706,8 @@ def generate_requires(
         if dependency_groups:
             generate_dependency_groups(dependency_groups, requirements)
         if include_runtime:
-            for extra in requirements.extras:
+            missing_extras = []
+            for extra in sorted(requirements.extras):
                 if extra not in requirements.metadata_extras:
                     if extra in requirements.extras_ok_nonexisting:
                         print_err(
@@ -714,10 +715,13 @@ def generate_requires(
                             f'Available extras: {requirements.metadata_extras}. '
                         )
                     else:
-                        raise ValueError(
-                            f'Extra {extra} does not exist in upstream metadata. '
-                            f'Available extras: {requirements.metadata_extras}.'
-                        )
+                        missing_extras.append(extra)
+            if missing_extras:
+                raise ValueError(
+                    f'Extras do not exist in upstream metadata: '
+                    f'{", ".join(missing_extras)}. '
+                    f'Available extras: {requirements.metadata_extras}.'
+                )
     except EndPass:
         return
     finally:

diff --git a/pyproject_buildrequires_testcases.yaml b/pyproject_buildrequires_testcases.yaml
index d963c0d..9435f68 100644
--- a/pyproject_buildrequires_testcases.yaml
+++ b/pyproject_buildrequires_testcases.yaml
@@ -430,6 +430,29 @@ Run dependencies with extra missing in metadata:
   except: ValueError
   result: 1
 
+Run dependencies with multiple extras missing in metadata:
+  installed:
+    setuptools: 50
+    wheel: 1
+    pyyaml: 1
+  include_runtime: true
+  generate_extras: true
+  extras:
+    - zzz-missing,testing,aaa-missing
+    - mmm-missing
+  setup.py: |
+    from setuptools import setup
+    setup(
+        extras_require={
+            'testing': ['dep1'],
+        },
+    )
+  environ:
+    FEDORA: "45"
+  except: ValueError
+  exception_contains: "aaa-missing, mmm-missing, zzz-missing"
+  result: 1
+
 Run dependencies with extra missing in metadata (older releases):
   installed:
     setuptools: 50

diff --git a/test_pyproject_buildrequires.py b/test_pyproject_buildrequires.py
index 6a27ba4..4d6c5cc 100644
--- a/test_pyproject_buildrequires.py
+++ b/test_pyproject_buildrequires.py
@@ -100,6 +100,8 @@ def test_data(case_name, capfd, tmp_path, monkeypatch):
         if 'except' not in case:
             raise
         assert type(e).__name__ == case['except']
+        if 'exception_contains' in case:
+            assert case['exception_contains'] in str(e)
     else:
         assert 0 == case['result']
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-30 23:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30 23:16 [rpms/pyproject-rpm-macros] rawhide: %pyproject_buildrequires: When multiple extras are missing from metadata, list them all (sorted) 

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox