For https://bugs.gnu.org/74434.
* lib/py-compile: if $PYTHON -V does not include the
string "python" (case-insensitive), consider the support
intentionally disabled and exit successfully, unless PYTHON is set
to false, in which case exit unsuccessfully. This is closer to
the old behavior. Mention this in the help message.
* t/py-compile-env.sh: add test for PYTHON=:.
* NEWS: mention this. (And, en passant, add some past bug#s and
clarify that only RCS/SCCS pattern rules were disabled, not all.)
* New supported languages
- - Support for Algol 68 added, based on the GNU Algol 68 compiler.
+ - Support for Algol 68 added, based on the GNU Algol 68 compiler. (bug#75807)
* Miscellaneous changes
- Avoid Perl 5.41.8+ precedence warning for use of !!.
- - The compile script is more robust to various Windows configurations.
+ - The py-compile script once again does nothing (successfully) if the
+ PYTHON environment variable is set to ":", or anything that isn't a
+ Python interpreter (according to $PYTHON -V). Exception: if PYTHON
+ is set to "false", do nothing but exit unsuccessfully, also to match
+ previous behavior. (bug#74434)
+
+ - The compile script is more robust to Windows configurations;
+ specifically, avoiding double-path translation on MSYS. (bug#75939)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
retained when appended. GNU Make & BSD Makes are known to support it.
(bug#7610)
- - GNU Make's default pattern rules are disabled, for speed and debugging.
- (.SUFFIXES was already cleared.) (bug#64743)
+ - GNU Make's default pattern rules for RCS and SCCS are disabled, for
+ speed and debugging. (.SUFFIXES was already cleared.) (bug#64743)
- For Texinfo documents, if a .texi.in file exists, but no .texi, the
.texi.in will be read. Texinfo source files need not be present at
me=py-compile
+# People apparently set PYTHON=: and expect the result to be true.
+# For the same reason, we output to stdout instead of stderr. Bizarre.
+if $PYTHON -V 2>/dev/null | grep -i python >/dev/null; then :; else
+ echo "$me: Invalid python executable (according to -V): $PYTHON"
+ echo "$me: Python support disabled"
+ if test x"$PYTHON" = xfalse; then
+ # But, as a special case, make PYTHON=false exit unsuccessfully,
+ # since that was the traditional behavior.
+ exit 1
+ # In the past, setting PYTHON to any command that exited unsuccessfully
+ # caused py-compile to exit unsuccessfully. Let's not try to
+ # replicate that unless and until needed.
+ else
+ exit 0
+ fi
+fi
+
usage_error ()
{
echo "$me: $*" >&2
cat <<\EOF
Usage: py-compile [options] FILES...
-Byte compile some python scripts FILES. Use --destdir to specify any
+Byte compile FILES as Python scripts. Use --destdir to specify a
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
do want to be shown in the byte compiled file.
Example:
py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py
+The Python interpreter to use is taken from the environment variable
+PYTHON, or "python" by default.
+
+For compatibility: as a special case, if PYTHON=false (that is, the
+command named "false"), this script will exit unsuccessfully. Otherwise,
+if $PYTHON -V does not include the string "Python", this script will
+emit a message to standard output and exit successfully.
+
Report bugs to <bug-automake@gnu.org>.
GNU Automake home page: <https://www.gnu.org/software/automake/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
mkdir sub1
cd sub1
+# This py-compile invocation should succeed and do nothing.
+PYTHON=: ../py-compile foo.py
+ls | grep . && exit 1
+
+# This py-compile invocation should fail and do nothing.
PYTHON=false ../py-compile foo.py && exit 1
ls | grep . && exit 1
+# These should also do nothing, and succeed.
PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py
PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py | grep 'GrEpMe AndMeToo'
ls | grep . && exit 1