dba17f7153b4bee8b2e2eb3bab49bd18c881191f
[platform/upstream/automake.git] / t / nobase-python.sh
1 #! /bin/sh
2 # Copyright (C) 2008-2012 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 . ./defs || exit 1
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
32 test-install-data: install-data
33         find inst -print; : For debugging.
34         test   -f inst/my/one.py
35         test   -f inst/my/one.pyc
36         test   -f inst/my/two.py
37         test   -f inst/my/two.pyc
38         test   -f inst/my/base.py
39         test   -f inst/my/base.pyc
40         test   -f inst/my/sub/nobase.py
41         test   -f inst/my/sub/nobase.pyc
42         test ! -f inst/my/nobase.py
43         test ! -f inst/my/nobase.pyc
44 END
45
46 mkdir sub
47
48 for file in one.py sub/base.py two.py sub/nobase.py; do
49   echo 'def one(): return 1' >$file
50 done
51
52 $ACLOCAL
53 $AUTOCONF
54 $AUTOMAKE --add-missing
55
56 ./configure --prefix "$(pwd)/inst" --program-prefix=p
57
58 $MAKE
59 $MAKE test-install-data
60 $MAKE uninstall
61
62 find inst/my -type f -print | grep . && exit 1
63
64 $MAKE install-strip
65
66 # Likewise, in a VPATH build.
67
68 $MAKE uninstall
69 $MAKE distclean
70 mkdir build
71 cd build
72 ../configure --prefix "$(pwd)/inst" --program-prefix=p
73 $MAKE
74 $MAKE test-install-data
75 $MAKE uninstall
76 find inst/my -type f -print | grep . && exit 1
77
78 :