py-compile (libcaca-0.99.beta19) | : | py-compile (libcaca-0.99.beta20.tar.bz2) | ||
---|---|---|---|---|
#!/bin/sh | #!/bin/sh | |||
# py-compile - Compile a Python program | # 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 | # Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009, 2011 Free | |||
# Foundation, Inc. | # Software Foundation, Inc. | |||
# This program is free software; you can redistribute it and/or modify | # 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 | # it under the terms of the GNU General Public License as published by | |||
# the Free Software Foundation; either version 2, or (at your option) | # the Free Software Foundation; either version 2, or (at your option) | |||
# any later version. | # any later version. | |||
# This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | |||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# GNU General Public License for more details. | # GNU General Public License for more details. | |||
skipping to change at line 35 | skipping to change at line 35 | |||
# the same distribution terms that you use for the rest of that program. | # the same distribution terms that you use for the rest of that program. | |||
# This file is maintained in Automake, please report | # This file is maintained in Automake, please report | |||
# bugs to <bug-automake@gnu.org> or send patches to | # bugs to <bug-automake@gnu.org> or send patches to | |||
# <automake-patches@gnu.org>. | # <automake-patches@gnu.org>. | |||
if [ -z "$PYTHON" ]; then | if [ -z "$PYTHON" ]; then | |||
PYTHON=python | PYTHON=python | |||
fi | fi | |||
me=py-compile | ||||
usage_error () | ||||
{ | ||||
echo "$me: $*" >&2 | ||||
echo "Try \`$me --help' for more information." >&2 | ||||
exit 1 | ||||
} | ||||
basedir= | basedir= | |||
destdir= | destdir= | |||
files= | ||||
while test $# -ne 0; do | while test $# -ne 0; do | |||
case "$1" in | case "$1" in | |||
--basedir) | --basedir) | |||
basedir=$2 | if test $# -lt 2; then | |||
if test -z "$basedir"; then | usage_error "option '--basedir' requires an argument" | |||
echo "$0: Missing argument to --basedir." 1>&2 | else | |||
exit 1 | basedir=$2 | |||
fi | fi | |||
shift | shift | |||
;; | ;; | |||
--destdir) | --destdir) | |||
destdir=$2 | if test $# -lt 2; then | |||
if test -z "$destdir"; then | usage_error "option '--destdir' requires an argument" | |||
echo "$0: Missing argument to --destdir." 1>&2 | else | |||
exit 1 | destdir=$2 | |||
fi | fi | |||
shift | shift | |||
;; | ;; | |||
-h|--h*) | -h|--help) | |||
cat <<\EOF | cat <<\EOF | |||
Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..." | Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..." | |||
Byte compile some python scripts FILES. Use --destdir to specify any | Byte compile some python scripts FILES. Use --destdir to specify any | |||
leading directory path to the FILES that you don't want to include in the | leading directory path to the FILES that you don't want to include in the | |||
byte compiled file. Specify --basedir for any additional path information you | byte compiled file. Specify --basedir for any additional path information you | |||
do want to be shown in the byte compiled file. | do want to be shown in the byte compiled file. | |||
Example: | Example: | |||
py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py | py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py | |||
Report bugs to <bug-automake@gnu.org>. | Report bugs to <bug-automake@gnu.org>. | |||
EOF | EOF | |||
exit $? | exit $? | |||
;; | ;; | |||
-v|--v*) | -v|--version) | |||
echo "py-compile $scriptversion" | echo "$me $scriptversion" | |||
exit $? | exit $? | |||
;; | ;; | |||
--) | ||||
shift | ||||
break | ||||
;; | ||||
-*) | ||||
usage_error "unrecognized option '$1'" | ||||
;; | ||||
*) | *) | |||
files="$files $1" | break | |||
;; | ;; | |||
esac | esac | |||
shift | shift | |||
done | done | |||
files=$* | ||||
if test -z "$files"; then | if test -z "$files"; then | |||
echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 | usage_error "no files given" | |||
exit 1 | ||||
fi | fi | |||
# if basedir was given, then it should be prepended to filenames before | # if basedir was given, then it should be prepended to filenames before | |||
# byte compilation. | # byte compilation. | |||
if [ -z "$basedir" ]; then | if [ -z "$basedir" ]; then | |||
pathtrans="path = file" | pathtrans="path = file" | |||
else | else | |||
pathtrans="path = os.path.join('$basedir', file)" | pathtrans="path = os.path.join('$basedir', file)" | |||
fi | fi | |||
End of changes. 12 change blocks. | ||||
18 lines changed or deleted | 33 lines changed or added |