maint: Update HACKING
[automake.git] / t / py-compile-env.sh
blobd25d67da3d6336936a6d7fe97059bb2a6d8a115e
1 #! /bin/sh
2 # Copyright (C) 2011-2017 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' honours 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 : > my-py.run
27 END
28 chmod a+x my-py
30 mkdir sub1
31 cd sub1
33 PYTHON=: ../py-compile foo.py
34 ls | grep . && exit 1
36 PYTHON=false ../py-compile foo.py && exit 1
37 ls | grep . && exit 1
39 PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py
40 PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py | grep 'GrEpMe AndMeToo'
41 ls | grep . && exit 1
43 cd ..
44 mkdir sub2
45 cd sub2
47 PYTHON=../my-py ../py-compile foo.py
48 test -f my-py.run
49 ls | grep -v '^my-py\.run$' | grep . && exit 1
51 cd ..
52 mkdir sub3
53 cd sub3
54 PATH=..$PATH_SEPARATOR$PATH; export PATH
55 PYTHON=my-py py-compile foo.py
56 test -f my-py.run
57 ls | grep -v '^my-py\.run$' | grep . && exit 1