public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/pyproject-rpm-macros] f45: Mention long options alongside short flags in error/help messages
Date: Tue, 13 Oct 2026 12:15:12 GMT	[thread overview]
Message-ID: <179189371247.1.17406338186498539585.rpms-pyproject-rpm-macros-f2dce3618c34@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/pyproject-rpm-macros
            Branch : f45
            Commit : f2dce3618c343f292d472a079eabc9f1fa951c6e
            Author : Miro Hrončok <miro@hroncok.cz>
            Date   : 2026-10-13T11:30:56+02:00
            Stats  : +21/-17 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/pyproject-rpm-macros/c/f2dce3618c343f292d472a079eabc9f1fa951c6e?branch=f45

            Log:
            Mention long options alongside short flags in error/help messages

Several error and help messages only referenced short options (e.g.
"-p flag", "-N option", "-D <name>"), which is confusing since the
long options are more descriptive.

Found candidates with:

    grep -rnP -- '(?<![\w./-])-[A-Za-z]\b(?!/--)' *.py macros.pyproject \
      | grep -vP -- "add_argument|'-[A-Za-z]', '--"

Then the LLM triaged, excluding shell/subprocess args, argparse
usage synopses, code comments, and test invocations.

I reviewed the diff for correctness, but not for full completeness,
more cases can be fixed later.
I decided not to spell -N/--no-use-build-system in its help,
so replaced with "this".

Assisted-By: Claude Sonnet 5

---
diff --git a/macros.pyproject b/macros.pyproject
index 5459b5d..15874f0 100644
--- a/macros.pyproject
+++ b/macros.pyproject
@@ -211,8 +211,8 @@ if [ ! -f "%{_pyproject_modules %{?__pyproject_optflag_D}}" ]; then
   _modules_glob=( %{_pyproject_modules_base}-* )
   if [ -e "${_modules_glob[0]}" ]; then
     _available=$(printf '%%s\n' "${_modules_glob[@]}" | sed 's|.*-pyproject-modules-||' | tr '\n' ' ')
-    echo "ERROR: %%%%pyproject_check_import requires -D <name> when %%%%pyproject_save_files was called with -D" >&2
-    echo "Available -D values: ${_available}" >&2
+    echo "ERROR: %%%%pyproject_check_import requires -D/--dist-name <name> when %%%%pyproject_save_files was called with -D/--dist-name" >&2
+    echo "Available -D/--dist-name values: ${_available}" >&2
   else
     echo 'ERROR: %%%%pyproject_check_import only works when %%%%pyproject_save_files is used' >&2
   fi

diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py
index 7382168..410109e 100644
--- a/pyproject_buildrequires.py
+++ b/pyproject_buildrequires.py
@@ -408,8 +408,8 @@ def generate_run_requirements_hook(backend, requirements):
             'The build backend cannot provide build metadata '
             '(incl. runtime requirements) before build. '
             'If the dependencies are specified in the pyproject.toml [project] '
-            'table, you can use the -p flag to read them. '
-            'Alternatively, use the -R flag not to generate runtime dependencies.'
+            'table, you can use the -p/--pyproject-dependencies flag to read them. '
+            'Alternatively, use the -R/--no-runtime flag not to generate runtime dependencies.'
         )
     dir_basename = prepare_metadata('.', requirements.config_settings)
     with open(dir_basename + '/METADATA') as metadata_file:
@@ -427,7 +427,7 @@ def find_built_wheel(wheeldir):
         return None
     if len(wheels) > 1:
         raise RuntimeError('Found multiple wheels in %{_pyproject_wheeldir}, '
-                           'this is not supported with %pyproject_buildrequires -w.')
+                           'this is not supported with %pyproject_buildrequires -w/--wheel.')
     return wheels[0]
 
 
@@ -438,8 +438,8 @@ def generate_run_requirements_wheel(backend, requirements, wheeldir):
         # pip is already echoed from the macro
         # but we need to explicitly restart if has not yet been installed
         # see https://bugzilla.redhat.com/2169855
-        requirements.add('pip >= 19', source='%pyproject_buildrequires -w')
-        requirements.check(source='%pyproject_buildrequires -w')
+        requirements.add('pip >= 19', source='%pyproject_buildrequires -w/--wheel')
+        requirements.check(source='%pyproject_buildrequires -w/--wheel')
         import pyproject_wheel
         returncode = pyproject_wheel.build_wheel(
             wheeldir=wheeldir,
@@ -447,10 +447,10 @@ def generate_run_requirements_wheel(backend, requirements, wheeldir):
             config_settings=requirements.config_settings,
         )
         if returncode != 0:
-            raise RuntimeError('Failed to build the wheel for %pyproject_buildrequires -w.')
+            raise RuntimeError('Failed to build the wheel for %pyproject_buildrequires -w/--wheel.')
         wheel = find_built_wheel(wheeldir)
     if not wheel:
-        raise RuntimeError('Cannot locate the built wheel for %pyproject_buildrequires -w.')
+        raise RuntimeError('Cannot locate the built wheel for %pyproject_buildrequires -w/--wheel.')
 
     print_err(f'Reading metadata from {wheel}')
     with zipfile.ZipFile(wheel) as wheelfile:
@@ -683,7 +683,10 @@ def generate_requires(
     dependency_groups = dependency_groups or []
     try:
         if (include_runtime or toxenv or pyproject_dependencies) and not use_build_system:
-            raise ValueError('-N option cannot be used in combination with -r, -e, -t, -x, -p options')
+            raise ValueError(
+                '-N/--no-use-build-system option cannot be used in combination with '
+                '-r/--runtime, -e/--toxenv, -t/--tox, -x/--extras, -p/--pyproject-dependencies options'
+            )
         if requirement_files:
             for req_file in requirement_files:
                 requirements.extend(
@@ -783,11 +786,12 @@ def argparser():
     )
     parser.add_argument(
         '-R', '--no-runtime', action='store_false', dest='runtime',
-        help="Don't generate run-time requirements (implied by -N)",
+        help="Don't generate run-time requirements (implied by -N/--no-use-build-system)",
     )
     parser.add_argument(
         '-N', '--no-use-build-system', dest='use_build_system',
-        action='store_false', help='Use -N to indicate that project does not use any build system',
+        action='store_false',
+        help='Use this to indicate that project does not use any build system',
     )
     parser.add_argument(
         'requirement_files', nargs='*', type=pathlib.Path,
@@ -821,7 +825,7 @@ def main(argv):
 
     if args.wheel:
         if not args.wheeldir:
-            raise ValueError('--wheeldir must be set when -w.')
+            raise ValueError('--wheeldir must be set when -w/--wheel.')
 
     if args.toxenv:
         args.tox = True

diff --git a/pyproject_save_files.py b/pyproject_save_files.py
index f5df963..f09b844 100644
--- a/pyproject_save_files.py
+++ b/pyproject_save_files.py
@@ -801,7 +801,7 @@ def load_parsed_record(pyproject_record, dist_name=None):
     elif len(content) > 1:
         raise ValueError(
             "%pyproject_install has found more than one *.dist-info/RECORD file. "
-            "Use %pyproject_save_files -D <name> to select a package. "
+            "Use %pyproject_save_files -D/--dist-name <name> to select a package. "
             f"Available: {', '.join(available)}"
         )
 
@@ -840,11 +840,11 @@ def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_versio
     if not globs and not allow_no_modules:
         raise ValueError(
             "At least one module glob needs to be provided to %pyproject_save_files. "
-            "Alternatively, use -M to indicate no Python modules should be saved."
+            "Alternatively, use -M/--allow-no-modules to indicate no Python modules should be saved."
         )
     if globs and allow_no_modules:
         raise ValueError(
-            "%pyproject_save_files -M cannot be used together with module globs."
+            "%pyproject_save_files -M/--allow-no-modules cannot be used together with module globs."
         )
     parsed_records = load_parsed_record(pyproject_record, dist_name)
 
@@ -873,7 +873,7 @@ def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_versio
             "No License-File (PEP 639) in upstream metadata found. "
             "Adjust the upstream metadata "
             "if the project's build backend supports PEP 639 "
-            "or use `%pyproject_save_files -L` "
+            "or use `%pyproject_save_files -L/--no-assert-license` "
             "and include the %license file in %files manually."
         )
 

                 reply	other threads:[~2026-10-13 12:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179189371247.1.17406338186498539585.rpms-pyproject-rpm-macros-f2dce3618c34@fedoraproject.org \
    --to=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox