am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / nobase-python.sh
1 #! /bin/sh
2 # Copyright (C) 2008-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 # Make sure nobase_* works for python files.
18
19 required=python
20 . test-init.sh
21
22 cat >>configure.ac <<EOF
23 AM_PATH_PYTHON
24 AC_OUTPUT
25 EOF
26
27 cat > Makefile.am <<'END'
28 mydir=$(prefix)/my
29 my_PYTHON = one.py sub/base.py
30 nobase_my_PYTHON = two.py sub/nobase.py
31 END
32
33 test_install()
34 {
35   $MAKE install-data
36   find inst -print # For debugging.
37   py_installed inst/my/one.py
38   py_installed inst/my/one.pyc
39   py_installed inst/my/two.py
40   py_installed inst/my/two.pyc
41   py_installed inst/my/base.py
42   py_installed inst/my/base.pyc
43   py_installed inst/my/sub/nobase.py
44   py_installed inst/my/sub/nobase.pyc
45   py_installed --not inst/my/nobase.py
46   py_installed --not inst/my/nobase.pyc
47 }
48
49 test_uninstall()
50 {
51   $MAKE uninstall
52   test -d inst/my
53   ! find inst/my -type f -print | grep .
54 }
55
56 mkdir sub
57
58 for file in one.py sub/base.py two.py sub/nobase.py; do
59   echo 'def one(): return 1' >$file
60 done
61
62 $ACLOCAL
63 $AUTOCONF
64 $AUTOMAKE --add-missing
65
66 ./configure --prefix "$(pwd)/inst" --program-prefix=p
67
68 $MAKE
69 test_install
70 test_uninstall
71
72 $MAKE install-strip
73 test_uninstall
74
75 # Likewise, in a VPATH build.
76
77 $MAKE distclean
78 mkdir build
79 cd build
80 ../configure --prefix "$(pwd)/inst" --program-prefix=p
81 test_install
82 test_uninstall
83
84 :