]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Improve compliance with GNU standards.
authorBruno Haible <bruno@clisp.org>
Sun, 31 Jul 2022 16:48:25 +0000 (18:48 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 31 Jul 2022 21:52:35 +0000 (23:52 +0200)
* gnulib-tool.py (main): Handle --help and --version before testing for
conflicting modes.

ChangeLog
gnulib-tool.py

index af97fc0ee664e9aceb6c5f3e9c20ef4445696daf..bdbdf1516f0ffa6790bb4649c829859817a98f0b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2022-07-31  Bruno Haible  <bruno@clisp.org>
 
+       gnulib-tool.py: Improve compliance with GNU standards.
+       * gnulib-tool.py (main): Handle --help and --version before testing for
+       conflicting modes.
+
        gnulib-tool.py: Emit error message when conflicting modes are specified.
        * gnulib-tool.py (main): Fix test of conflicting modes. (Some options
        produce a value of [], and as a condition, [] evaluates to False.)
index b16becb1d2a1ea597fbe381049678a30b7b7ff59..a6d4f6fa75b116e0c2709f24787b43960890de6e 100755 (executable)
@@ -340,6 +340,17 @@ def main():
     # Parse the given arguments.
     cmdargs = parser.parse_args()
 
+    # Handle --help and --version, ignoring all other options.
+    if cmdargs.help != None:
+        print(info.usage())
+        sys.exit(0)
+    if cmdargs.version != None:
+        message = '''gnulib-tool (%s %s)%s\n%s\n%s\n\nWritten by %s.''' % \
+            (info.package(), info.date(), info.version(), info.copyright(),
+             info.license(), info.authors())
+        print(message)
+        sys.exit(0)
+
     # Determine when user tries to combine modes.
     args = [
         cmdargs.mode_list,
@@ -374,15 +385,6 @@ def main():
         sys.exit(1)
 
     # Determine selected mode.
-    if cmdargs.help != None:
-        print(info.usage())
-        sys.exit(0)
-    if cmdargs.version != None:
-        message = '''gnulib-tool (%s %s)%s\n%s\n%s\n\nWritten by %s.''' % \
-            (info.package(), info.date(), info.version(), info.copyright(),
-             info.license(), info.authors())
-        print(message)
-        sys.exit(0)
     if cmdargs.mode_list != None:
         mode = 'list'
     if cmdargs.mode_import != None: