aboutsummaryrefslogtreecommitdiff
path: root/py-compile
diff options
context:
space:
mode:
Diffstat (limited to 'py-compile')
-rwxr-xr-xpy-compile51
1 files changed, 33 insertions, 18 deletions
diff --git a/py-compile b/py-compile
index 3f9d05b..15c834c 100755
--- a/py-compile
+++ b/py-compile
@@ -1,10 +1,10 @@
#!/bin/sh
# py-compile - Compile a Python program
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2011-06-08.12; # UTC
-# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009 Free Software
-# Foundation, Inc.
+# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009, 2011 Free
+# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,28 +32,36 @@ 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=
while test $# -ne 0; do
case "$1" in
--basedir)
- basedir=$2
- if test -z "$basedir"; then
- echo "$0: Missing argument to --basedir." 1>&2
- exit 1
+ if test $# -lt 2; then
+ usage_error "option '--basedir' requires an argument"
+ else
+ basedir=$2
fi
shift
;;
--destdir)
- destdir=$2
- if test -z "$destdir"; then
- echo "$0: Missing argument to --destdir." 1>&2
- exit 1
+ if test $# -lt 2; then
+ usage_error "option '--destdir' requires an argument"
+ else
+ destdir=$2
fi
shift
;;
- -h|--h*)
+ -h|--help)
cat <<\EOF
Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..."
@@ -69,20 +77,27 @@ Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
- -v|--v*)
- echo "py-compile $scriptversion"
+ -v|--version)
+ echo "$me $scriptversion"
exit $?
;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ usage_error "unrecognized option '$1'"
+ ;;
*)
- files="$files $1"
+ break
;;
esac
shift
done
+files=$*
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