summaryrefslogtreecommitdiff
path: root/t/python12.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/python12.sh')
-rw-r--r--t/python12.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/t/python12.sh b/t/python12.sh
new file mode 100644
index 000000000..f804d84c1
--- /dev/null
+++ b/t/python12.sh
@@ -0,0 +1,54 @@
+#! /bin/sh
+# Copyright (C) 2004-2017 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 <https://www.gnu.org/licenses/>.
+
+# Ensure DESTDIR is not included in byte-compiled files.
+
+required=python
+. test-init.sh
+
+cat >>configure.ac <<'EOF'
+AM_PATH_PYTHON
+AC_OUTPUT
+EOF
+
+cat >Makefile.am <<'END'
+mydir = $(datadir)/my
+my_PYTHON = my.py
+
+my.py:
+ echo 'def my(): return 1' >$@
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+destdir=$(pwd)/inst
+mkdir inst build
+cd build
+../configure --prefix="/usr"
+$MAKE install DESTDIR=$destdir
+
+# Perfunctory test that the files were created.
+test -f "$destdir/usr/share/my/my.py"
+pyo=$(pyc_location -p "$destdir/usr/share/my/my.pyo")
+pyc=$(pyc_location -p "$destdir/usr/share/my/my.pyc")
+
+# If DESTDIR has made it into the byte compiled files, fail the test.
+st=0; $FGREP "$destdir" "$pyc" "$pyo" || st=$?
+test $st -eq 1
+
+: