summaryrefslogtreecommitdiff
path: root/t/py-compile-env.sh
blob: 5dd7e5f5cd5fd7863071c919faa1ea2a416967e5 (plain)
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
#! /bin/sh
# Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>.

# Make sure 'py-compile' honours the PYTHON environment variable.

. ./defs || Exit 1

cp "$am_scriptdir/py-compile" . \
  || fatal_ "failed to fetch auxiliary script py-compile"

cat > my-py <<'END'
#!/bin/sh
: > my-py.run
END
chmod a+x my-py

mkdir sub1
cd sub1

PYTHON=: ../py-compile foo.py
ls | grep . && Exit 1

PYTHON=false ../py-compile foo.py && Exit 1
ls | grep . && Exit 1

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

: