Branch
Hash :
0ea7ef97
Author :
Date :
2025-02-09T09:36:24
python: restore more compatible behavior for $PYTHON. 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.)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
#! /bin/sh
# Copyright (C) 2011-2025 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 <https://www.gnu.org/licenses/>.
# Make sure 'py-compile' honors the PYTHON environment variable.
. test-init.sh
cp "$am_scriptdir/py-compile" . \
|| fatal_ "failed to fetch auxiliary script py-compile"
cat > my-py <<'END'
#!/bin/sh
echo 2
: > my-py.run
END
chmod a+x my-py
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
cd ..
mkdir sub2
cd sub2
PYTHON=../my-py ../py-compile foo.py
test -f my-py.run
ls | grep -v '^my-py\.run$' | grep . && exit 1
cd ..
mkdir sub3
cd sub3
PATH=..$PATH_SEPARATOR$PATH; export PATH
PYTHON=my-py py-compile foo.py
test -f my-py.run
ls | grep -v '^my-py\.run$' | grep . && exit 1
: