public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/pyproject-rpm-macros] f44: %pyproject_extras_subpkg: Add long options support
@ 2026-07-24 19:58 
  0 siblings, 0 replies; only message in thread
From:  @ 2026-07-24 19:58 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/pyproject-rpm-macros
            Branch : f44
            Commit : 5d0daabdf4a8e58444311c6a205776fb2c11c185
            Author : Miro Hrončok <miro@hroncok.cz>
            Date   : 2026-07-24T16:05:06+02:00
            Stats  : +41/-5 in 6 file(s)
            URL    : https://src.fedoraproject.org/rpms/pyproject-rpm-macros/c/5d0daabdf4a8e58444311c6a205776fb2c11c185?branch=f44

            Log:
            %pyproject_extras_subpkg: Add long options support

This was blocked on the previous commit.

Assisted-By: Claude Opus 4.6

---
diff --git a/README.md b/README.md
index a654d83..d258acc 100644
--- a/README.md
+++ b/README.md
@@ -649,6 +649,18 @@ Here is a complete reference of all options:
 | `-D NAME` | `--dist-name NAME`    | Check imports for a specific distribution package |
 | `-t`      | `--top-level-only`    | Only check top-level modules                      |
 
+### `%pyproject_extras_subpkg`
+
+| Short      | Long                      | Description                                                                                 |
+|------------|---------------------------|---------------------------------------------------------------------------------------------|
+| `-n NAME`  | `--name NAME`             | Name of the base RPM package (required)                                                     |
+| `-D NAME`  | `--dist-name NAME`        | Select %ghost .dist-info for a specific distribution package (not applicable with -i/-f/-F) |
+| `-a`       | `--noarch`                | Insert BuildArch: noarch                                                                    |
+| `-A`       | `--no-noarch`             | Do not insert BuildArch: noarch (default)                                                   |
+| `-i PATH`  | `--dist-info-path PATH`   | Custom buildroot path to the .dist-info metadata folder (optional, advanced usage)          |
+| `-f FILE`  | `--filelist FILE`         | Custom path to a filelist (optional, advanced usage)                                        |
+| `-F`       | `--no-filelist`           | Skip %files section entirely (optional, advanced usage)                                     |
+
 ### `%tox`
 
 | Short       | Long              | Description          |

diff --git a/macros.pyproject b/macros.pyproject
index 3fe295b..204f844 100644
--- a/macros.pyproject
+++ b/macros.pyproject
@@ -156,9 +156,31 @@ fi
 }
 
 
-# Note: the three times nested questionmarked -i -f -F pattern means: If none of those options was used -- in that case, we inject our own -f
+# Note: the three times nested __pyproject_opt_{i,f,F} pattern means: If none of those options was used -- in that case, we inject our own -f
 # -D selects the per-package ghost distinfo file for multi-wheel installs
-%pyproject_extras_subpkg(n:i:f:FaAD:) %{expand:%{?python_extras_subpkg:%{python_extras_subpkg%{!?-i:%{!?-f:%{!?-F: -f %{_pyproject_ghost_distinfo %{?-D}}}}} %{?-n} %{?-i} %{?-f} %{?-F} %{?-a} %{?-A} %*}}}
+%pyproject_extras_subpkg(-) \
+%{lua:require("fedora.rpm.pyproject_getopt").getopt({
+    {short="n", long="name", value=true},
+    {short="i", long="dist-info-path", value=true},
+    {short="f", long="filelist", value=true},
+    {short="F", long="no-filelist"},
+    {short="a", long="noarch"},
+    {short="A", long="no-noarch"},
+    {short="D", long="dist-name", value=true},
+})}\
+%{expand:\\\
+%{?python_extras_subpkg:\\\
+%{python_extras_subpkg\\\
+  %{!?__pyproject_opt_i:%{!?__pyproject_opt_f:%{!?__pyproject_opt_F:\\\
+    -f %{_pyproject_ghost_distinfo %{?__pyproject_optflag_D}}}}}\\\
+  %{?__pyproject_optflag_n}\\\
+  %{?__pyproject_optflag_i}\\\
+  %{?__pyproject_optflag_f}\\\
+  %{?__pyproject_optflag_F}\\\
+  %{?__pyproject_optflag_a}\\\
+  %{?__pyproject_optflag_A}\\\
+  %{?__pyproject_positional_args}\\\
+}}%{__pyproject_getopt_restore}}
 
 
 # Escaping shell-globs, percentage signs and spaces was reworked in RPM 4.19+

diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec
index 8deb49c..f148b8e 100644
--- a/pyproject-rpm-macros.spec
+++ b/pyproject-rpm-macros.spec
@@ -181,6 +181,7 @@ export HOSTNAME="rpmbuild"  # to speedup tox in network-less mock, see rhbz#1856
 %changelog
 * Thu Jul 23 2026 Miro Hrončok <mhroncok@redhat.com> - 1.23.1-1
 - getopt: Fix global macro clobbering with save/restore stack
+- %%pyproject_extras_subpkg: Add long options support
 
 * Thu Jul 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 1.23.0-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild

diff --git a/test_pyproject_getopt_consistency.py b/test_pyproject_getopt_consistency.py
index b4c5af9..ef9967e 100644
--- a/test_pyproject_getopt_consistency.py
+++ b/test_pyproject_getopt_consistency.py
@@ -21,6 +21,7 @@ MACROS_PYTHON = (
 MACROS_README = (
     "pyproject_buildrequires",
     "pyproject_check_import",
+    "pyproject_extras_subpkg",
     "pyproject_save_files",
     "pyproject_wheel",
     "tox",

diff --git a/tests/double-install.spec b/tests/double-install.spec
index cec520a..0ddef73 100644
--- a/tests/double-install.spec
+++ b/tests/double-install.spec
@@ -24,7 +24,7 @@ Summary:        markdown-it-py from double-install test
 markdown-it-py subpackage.
 
 # Note: Throughout this spec, we use mixed case and -_ inconsistently in -D to assert it is correctly normalized
-%pyproject_extras_subpkg -n python3-double-markdown-it-py -D MARKDOWN-it_py linkify
+%pyproject_extras_subpkg -n python3-double-markdown-it-py --dist-name MARKDOWN-it_py linkify
 
 
 %package -n python3-double-setuptools-scm
@@ -33,7 +33,7 @@ Summary:        setuptools_scm from double-install test
 %description -n python3-double-setuptools-scm
 setuptools_scm subpackage.
 
-%pyproject_extras_subpkg -n python3-double-setuptools-scm -D Setuptools_scm toml
+%pyproject_extras_subpkg --name python3-double-setuptools-scm --dist-name Setuptools_scm toml
 
 
 %prep

diff --git a/tests/python-markdown-it-py.spec b/tests/python-markdown-it-py.spec
index 06107bd..2db91ca 100644
--- a/tests/python-markdown-it-py.spec
+++ b/tests/python-markdown-it-py.spec
@@ -20,7 +20,7 @@ Summary:        %{summary}
 %description -n python3-markdown-it-py
 ...
 
-%pyproject_extras_subpkg -n python3-markdown-it-py linkify
+%pyproject_extras_subpkg --name python3-markdown-it-py linkify
 
 %prep
 %autosetup -p1 -n markdown-it-py-%{version}

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

only message in thread, other threads:[~2026-07-24 19:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-24 19:58 [rpms/pyproject-rpm-macros] f44: %pyproject_extras_subpkg: Add long options support 

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