summaryrefslogtreecommitdiff
path: root/lib/py-compile
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2011-06-08 22:00:38 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2011-06-09 15:58:12 +0200
commit429b748cecaa046d11f5a93bea0c93c809179ed6 (patch)
tree91a8f6d4dd51bbec84f07649ef343959a4e89111 /lib/py-compile
parenta716df2ed5f62889d3b442d5ecc5e2edd6794ee4 (diff)
downloadautomake-429b748cecaa046d11f5a93bea0c93c809179ed6.tar.gz
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 error messages with the name of the script, not with its path. When an invalid usage is recognized, always display the customary message "Try `py-compile --help' ..." on a line of its own. ($me): New variable, containing the name of the program, i.e., `py-compile'. Use it throughout. (usage_error): New function, used to display error messages about invalid usage. * tests/py-compile-usage.test: Extend and tighten accordingly.
Diffstat (limited to 'lib/py-compile')
-rwxr-xr-xlib/py-compile20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/py-compile b/lib/py-compile
index 2a526cab7..140536bd1 100755
--- a/lib/py-compile
+++ b/lib/py-compile
@@ -32,6 +32,15 @@ if [ -z "$PYTHON" ]; then
PYTHON=python
fi
+me=py-compile
+
+usage_error ()
+{
+ echo "$me: $*" >&2
+ echo "Try \`$me --help' for more information." >&2
+ exit 1
+}
+
basedir=
destdir=
files=
@@ -39,8 +48,7 @@ while test $# -ne 0; do
case "$1" in
--basedir)
if test $# -lt 2; then
- echo "$0: Missing argument to --basedir." 1>&2
- exit 1
+ usage_error "option '--basedir' requires an argument"
else
basedir=$2
fi
@@ -48,8 +56,7 @@ while test $# -ne 0; do
;;
--destdir)
if test $# -lt 2; then
- echo "$0: Missing argument to --destdir." 1>&2
- exit 1
+ usage_error "option '--destdir' requires an argument"
else
destdir=$2
fi
@@ -72,7 +79,7 @@ EOF
exit $?
;;
-v|--v*)
- echo "py-compile $scriptversion"
+ echo "$me $scriptversion"
exit $?
;;
*)
@@ -83,8 +90,7 @@ EOF
done
if test -z "$files"; then
- echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
- exit 1
+ usage_error "no files given"
fi
# if basedir was given, then it should be prepended to filenames before