]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
py-compile: complain on unrecognized options
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 8 Jun 2011 20:10:08 +0000 (22:10 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 9 Jun 2011 13:59:11 +0000 (15:59 +0200)
* lib/py-compile: Complain on unrecognized options.  Don't be too
lax in matching `--help' and `--version' options.
* tests/py-compile-usage.test: Extend accordingly.
* NEWS: Update.

ChangeLog
NEWS
lib/py-compile
tests/py-compile-usage.test

index 070ac066abda69e8f4c89b53af5c50d8e1c831b5..a530cb86be95eb2760d1b203d2194f390ff9af24 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-06-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       py-compile: complain on unrecognized options
+       * lib/py-compile: Complain on unrecognized options.  Don't be too
+       lax in matching `--help' and `--version' options.
+       * tests/py-compile-usage.test: Extend accordingly.
+       * NEWS: Update.
+
 2011-06-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        py-compile: normalize error and help messages
diff --git a/NEWS b/NEWS
index 5ebae6ebec93c2a597ba2cc2583e78bb26e3e108..745c6c727f3fcc546df2ad2dec8e4f403eef5bab 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ New in 1.11.0a:
     is obsoleted by `xz' and `dist-xz' due to upstream changes.
 
   - The py-compile script now accepts empty arguments passed to the options
-    `--destdir' and `--basedir'.
+    `--destdir' and `--basedir', and complains about unrecognized options.
 
 Bugs fixed in 1.11.0a:
 
index 140536bd189897e2b72870ef14db824492c1a7ff..7aa242553a2733617e18aff6a1e23a1ccc1a919f 100755 (executable)
@@ -62,7 +62,7 @@ while test $# -ne 0; do
       fi
       shift
       ;;
-    -h|--h*)
+    -h|--help)
       cat <<\EOF
 Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..."
 
@@ -78,10 +78,13 @@ Report bugs to <bug-automake@gnu.org>.
 EOF
       exit $?
       ;;
-    -v|--v*)
+    -v|--version)
       echo "$me $scriptversion"
       exit $?
       ;;
+    -*)
+      usage_error "unrecognized option '$1'"
+      ;;
     *)
       files="$files $1"
       ;;
index 6a0f2f2a3a2d893edcc673ed510f365d55f60273..7e8c786052bec8fd6cff01164800bb938a2a1f7d 100755 (executable)
@@ -46,6 +46,14 @@ hour='([01][0-9]|2[0123])'
 LC_ALL=C $EGREP "^py-compile $year-$month-$day\.$hour" stdout
 test `wc -l <stdout` -eq 1
 
+# Unknown option.
+for opt in -b -d --foo; do
+  ./py-compile $opt 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr >&2
+  grep "^py-compile: unrecognized option ['\`]$opt'" stderr
+  grep "^Try [\`']py-compile --help' for more information" stderr
+done
+
 # Missing option argument.
 
 for opt in --basedir --destdir; do