maint: post-release version bump to 1.17.0.90
[automake.git] / t / py-compile-env.sh
blobb4ba6dcbe6fecb033bd271a72da68a548ff3e2f8
1 #! /bin/sh
2 # Copyright (C) 2011-2024 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Make sure 'py-compile' honors the PYTHON environment variable.
19 . test-init.sh
21 cp "$am_scriptdir/py-compile" . \
22 || fatal_ "failed to fetch auxiliary script py-compile"
24 cat > my-py <<'END'
25 #!/bin/sh
26 echo 2
27 : > my-py.run
28 END
29 chmod a+x my-py
31 mkdir sub1
32 cd sub1
34 PYTHON=false ../py-compile foo.py && exit 1
35 ls | grep . && exit 1
37 PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py
38 PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py | grep 'GrEpMe AndMeToo'
39 ls | grep . && exit 1
41 cd ..
42 mkdir sub2
43 cd sub2
45 PYTHON=../my-py ../py-compile foo.py
46 test -f my-py.run
47 ls | grep -v '^my-py\.run$' | grep . && exit 1
49 cd ..
50 mkdir sub3
51 cd sub3
52 PATH=..$PATH_SEPARATOR$PATH; export PATH
53 PYTHON=my-py py-compile foo.py
54 test -f my-py.run
55 ls | grep -v '^my-py\.run$' | grep . && exit 1