tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / python-missing.sh
1 #! /bin/sh
2 # Copyright (C) 2003-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Test detection of missing Python.
18 # See also related test t/python-am-path-missing-2.sh (which requires
19 # an actual python program).
20
21 am_create_testdir=empty
22 # An actual python is *not* required in this test.
23 . test-init.sh
24
25 unset PYTHON
26
27 cat > configure.ac <<END
28 AC_INIT([$me], [1.0])
29 m4_include([mypy.m4])
30 AC_OUTPUT
31 END
32
33 echo AM_PATH_PYTHON > mypy.m4
34
35 $ACLOCAL
36 $AUTOCONF
37
38 # Simulate no Python.
39 ./configure PYTHON=: 2>stderr && { cat stderr >&2; exit 1; }
40 cat stderr >&2
41 grep 'no suitable Python interpreter found' stderr
42
43 # Again, but from the environment this time.
44 env PYTHON=: ./configure 2>stderr && { cat stderr >&2; exit 1; }
45 cat stderr >&2
46 grep 'no suitable Python interpreter found' stderr
47
48 # Now try using a custom ACTION-IF-NOT-FOUND.
49
50 echo 'AM_PATH_PYTHON(,, [echo "$PYTHON" > py])' > mypy.m4
51 $AUTOCONF --force
52 ./configure PYTHON=:
53 test x"$(cat py)" = x:
54
55 # Now try requiring a version.
56
57 rm -rf autom4te*.cache # Will have to re-run aclocal.
58
59 # Hopefully the Python team will never release such a version :-)
60 echo 'AM_PATH_PYTHON([9999.9], [])' > mypy.m4
61 # The "--force" options (here and below) are truly needed to avoid
62 # potential timestamp races.  See automake bug#12210.
63 $ACLOCAL --force
64 $AUTOCONF --force
65 ./configure >stdout 2>stderr && {
66   cat stdout
67   cat stderr >&2
68   exit 1
69 }
70 cat stdout
71 cat stderr >&2
72 $EGREP 'checking for a Python interpreter with version >= 9999\.9\.\.\. no(ne)? *$' stdout
73 grep 'no suitable Python interpreter found' stderr
74
75 # Now try requiring a version and using a custom ACTION-IF-NOT-FOUND.
76
77 echo 'AM_PATH_PYTHON([9999.9], [], [echo "$PYTHON" > py])' > mypy.m4
78 $AUTOCONF --force
79 ./configure
80 test x"$(cat py)" = x:
81
82 :