2011-06-08 Stefano Lattarini <stefano.lattarini@gmail.com>
+ py-compile: '--' and non-option arguments terminate the option list
+ * lib/py-compile: Any non-option argument, or the special `--'
+ argument, now explicitly terminates the list of options.
+ * tests/py-compile-option-terminate.test: New test.
+ * tests/Makefile.am (TESTS): Update.
+ * NEWS: Update.
+
+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.
- The py-compile script now accepts empty arguments passed to the options
`--destdir' and `--basedir', and complains about unrecognized options.
+ Moreover, a non-option argument or a special `--' arguments terminates
+ the list of options.
Bugs fixed in 1.11.0a:
basedir=
destdir=
-files=
while test $# -ne 0; do
case "$1" in
--basedir)
echo "$me $scriptversion"
exit $?
;;
+ --)
+ shift
+ break
+ ;;
-*)
usage_error "unrecognized option '$1'"
;;
*)
- files="$files $1"
+ break
;;
esac
shift
done
+files=$*
if test -z "$files"; then
usage_error "no files given"
fi
py-compile-basedir.test \
py-compile-destdir.test \
py-compile-env.test \
+py-compile-option-terminate.test \
py-compile-usage.test \
python.test \
python2.test \
py-compile-basedir.test \
py-compile-destdir.test \
py-compile-env.test \
+py-compile-option-terminate.test \
py-compile-usage.test \
python.test \
python2.test \
--- /dev/null
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that a `--' argument explicitly terminates option list for
+# `py-compile'.
+
+required=python
+. ./defs || Exit 1
+
+set -e
+
+cp "$testsrcdir/../lib/py-compile" .
+
+: > ./-o.py
+: > ./--foo.py
+./py-compile -- -o.py --foo.py
+test -f ./-o.pyc
+test -f ./-o.pyo
+test -f ./--foo.pyc
+test -f ./--foo.pyo
+rm -f ./-*.py[co]
+: > x.py
+./py-compile x.py -o.py --foo.py
+test -f ./x.pyc
+test -f ./x.pyo
+test -f ./-o.pyc
+test -f ./-o.pyo
+test -f ./--foo.pyc
+test -f ./--foo.pyo
+
+: