GNU bug report logs -
#74434
[PATCH] py-compile: Allow user to disable python
Previous Next
Reported by: Frédéric Bérat <fberat <at> redhat.com>
Date: Tue, 19 Nov 2024 09:55:02 UTC
Severity: normal
Tags: patch
Done: Karl Berry <karl <at> freefriends.org>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 74434 <at> debbugs.gnu.org (full text, mbox):
Hi,
Here is a revision of the patch, so that py-compile-en.sh test passes.
I leave to you to decide if a test dedicated to "PYTHON=:" is truly necessary.
Fred.
-- 8< --
Subject: [PATCH v2] py-compile: Allow user to disable python
Common practice is to set PYTHON=: to disable python support, which
breaks the current version of this script.
---
lib/py-compile | 8 ++++++++
t/py-compile-env.sh | 20 ++++++++++----------
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/lib/py-compile b/lib/py-compile
index c9d4fde94..332cb4b79 100755
--- a/lib/py-compile
+++ b/lib/py-compile
@@ -33,6 +33,14 @@ fi
me=py-compile
+case "$PYTHON" in
+ *python*) ;;
+ *)
+ echo "$me: Invalid python executable ${PYTHON}";
+ echo "$me: Python support disabled";
+ exit 0;;
+esac
+
usage_error ()
{
echo "$me: $*" >&2
diff --git a/t/py-compile-env.sh b/t/py-compile-env.sh
index b4ba6dcbe..7d8766b30 100644
--- a/t/py-compile-env.sh
+++ b/t/py-compile-env.sh
@@ -21,17 +21,17 @@
cp "$am_scriptdir/py-compile" . \
|| fatal_ "failed to fetch auxiliary script py-compile"
-cat > my-py <<'END'
+cat > my-python <<'END'
#!/bin/sh
echo 2
-: > my-py.run
+: > my-python.run
END
-chmod a+x my-py
+chmod a+x my-python
mkdir sub1
cd sub1
-PYTHON=false ../py-compile foo.py && exit 1
+! PYTHON=false ../py-compile foo.py && exit 1
ls | grep . && exit 1
PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py
@@ -42,16 +42,16 @@ 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
+PYTHON=../my-python ../py-compile foo.py
+test -f my-python.run
+ls | grep -v '^my-python\.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
+PYTHON=my-python py-compile foo.py
+test -f my-python.run
+ls | grep -v '^my-python\.run$' | grep . && exit 1
:
--
2.47.0
This bug report was last modified 162 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.