From: Stefano Lattarini Date: Wed, 8 Jun 2011 20:10:08 +0000 (+0200) Subject: py-compile: complain on unrecognized options X-Git-Tag: v1.12.0b~272^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd16ceb382de8f64d44efd7dd1948c33fc52566e;p=platform%2Fupstream%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 070ac06..a530cb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2011-06-08 Stefano Lattarini + 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 + py-compile: normalize error and help messages * lib/py-compile: Now error messages do not begin with a capital letter, nor end with a period, as per GNU standards. Prepend the diff --git a/NEWS b/NEWS index 5ebae6e..745c6c7 100644 --- 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: diff --git a/lib/py-compile b/lib/py-compile index 140536b..7aa2425 100755 --- a/lib/py-compile +++ b/lib/py-compile @@ -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 . EOF exit $? ;; - -v|--v*) + -v|--version) echo "$me $scriptversion" exit $? ;; + -*) + usage_error "unrecognized option '$1'" + ;; *) files="$files $1" ;; diff --git a/tests/py-compile-usage.test b/tests/py-compile-usage.test index 6a0f2f2..7e8c786 100755 --- a/tests/py-compile-usage.test +++ b/tests/py-compile-usage.test @@ -46,6 +46,14 @@ hour='([01][0-9]|2[0123])' LC_ALL=C $EGREP "^py-compile $year-$month-$day\.$hour" stdout test `wc -l 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