* t/python8.sh, t/python9.sh: Merge into ...
* t/python-am-path-iftrue.sh: ... this new test, with minor adjustments.
* t/python4.sh, t/python5.sh, t/python6.sh, t/python7.sh: Merge into ...
* t/python-missing.sh: ... this new test.
* t/python5b.sh: Rename ...
* t/python-too-old.sh: ... like this, and adjust/extend.
* t/list-of-tests.mk: Adjust.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
t/python.sh \
t/python2.sh \
t/python3.sh \
-t/python4.sh \
-t/python5.sh \
-t/python5b.sh \
-t/python6.sh \
-t/python7.sh \
-t/python8.sh \
-t/python9.sh \
t/python10.sh \
t/python11.sh \
t/python12.sh \
+t/python-am-path-iftrue.sh \
+t/python-missing.sh \
+t/python-too-old.sh \
t/python-dist.sh \
t/python-vars.sh \
t/python-virtualenv.sh \
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test ACTION-IF-TRUE in AM_PATH_PYTHON.
-# Similar to 'python8.sh', but requiring a version.
+am_create_testdir=empty
required=python
. ./defs || exit 1
-cat >>configure.ac <<'EOF'
-# $PYTHON is supposed to be properly set in ACTION-IF-TRUE.
-AM_PATH_PYTHON([0.0], [$PYTHON -c 'print("%u:%u" % (1-1, 2**0))' > py.out])
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
+m4_include([mypy.m4])
AC_OUTPUT
-EOF
+END
-: > Makefile.am
+# $PYTHON is supposed to be properly set in ACTION-IF-TRUE.
+cat > mypy.m4 << 'END'
+AM_PATH_PYTHON(, [$PYTHON -V >py-version 2>&1])
+END
$ACLOCAL
$AUTOCONF
-$AUTOMAKE --add-missing
+./configure
+grep '^Python [0-9]\.[0-9][0-9]*\.[0-9]' py-version
+
+# The same, but requiring a version.
+
+rm -rf autom4te*.cache
+# $PYTHON is supposed to be properly set in ACTION-IF-TRUE.
+cat > mypy.m4 << 'END'
+AM_PATH_PYTHON([0.0], [$PYTHON -c 'print("%u:%u" % (1-1, 2**0))' > py.out])
+END
+
+$ACLOCAL
+$AUTOCONF
./configure
test x"$(cat py.out)" = x0:1
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2003-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/>.
+
+# Test detection of missing Python.
+# See also related test t/python-am-path-missing-2.sh (which requires
+# an actual python program).
+
+am_create_testdir=empty
+# An actual python is *not* required in this test.
+. ./defs || exit 1
+
+PYTHON=; unset PYTHON
+
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
+m4_include([mypy.m4])
+AC_OUTPUT
+END
+
+echo AM_PATH_PYTHON > mypy.m4
+
+$ACLOCAL
+$AUTOCONF
+
+# Simulate no Python.
+./configure PYTHON=: 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+grep 'no suitable Python interpreter found' stderr
+
+# Again, but from the environment this time.
+env PYTHON=: ./configure 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+grep 'no suitable Python interpreter found' stderr
+
+# Now try using a custom ACTION-IF-NOT-FOUND.
+
+echo 'AM_PATH_PYTHON(,, [echo "$PYTHON" > py])' > mypy.m4
+$AUTOCONF --force
+./configure PYTHON=:
+test x"$(cat py)" = x:
+
+# Now try requiring a version.
+
+rm -rf autom4te*.cache # Will have to re-run aclocal.
+
+# Hopefully the Python team will never release such a version :-)
+echo 'AM_PATH_PYTHON([9999.9], [])' > mypy.m4
+$ACLOCAL
+$AUTOCONF
+./configure >stdout 2>stderr && {
+ cat stdout
+ cat stderr >&2
+ exit 1
+}
+cat stdout
+cat stderr >&2
+$EGREP 'checking for a Python interpreter with version >= 9999\.9\.\.\. no(ne)? *$' stdout
+grep 'no suitable Python interpreter found' stderr
+
+# Now try requiring a version and using a custom ACTION-IF-NOT-FOUND.
+
+echo 'AM_PATH_PYTHON([9999.9], [], [echo "$PYTHON" > py])' > mypy.m4
+$AUTOCONF --force
+./configure
+test x"$(cat py)" = x:
+
+:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test detection of missing Python.
-# Same as 'python5.sh', but with the user forcing the python to use.
+# Test detection of too old Python, also forcing the python to use.
+# See also related test 't/python-am-path-missing.sh'.
+am_create_testdir=empty
required=python
. ./defs || exit 1
-cat >>configure.ac << 'END'
+py_too_old ()
+{
+ ./configure ${1+"PYTHON=$1"} >stdout 2>stderr && {
+ cat stdout
+ cat stderr >&2
+ exit 1
+ }
+ cat stdout
+ cat stderr >&2
+ grep "whether $1 version is >= 9999\\.9\\.\\.\\. no *$" stdout
+ grep '[Pp]ython interpreter is too old' stderr
+}
+
+PYTHON=; unset PYTHON
+
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
# Hopefully the Python team will never release such a version.
AM_PATH_PYTHON([9999.9])
-AC_OUTPUT
END
+$ACLOCAL
+$AUTOCONF
+
+py_too_old python
+
mkdir bin
cat > bin/my-python << 'END'
#! /bin/sh
chmod a+x bin/my-python
PATH=$(pwd)/bin$PATH_SEPARATOR$PATH
-: > Makefile.am
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE --add-missing
-
-./configure PYTHON=my-python >stdout 2>stderr && {
- cat stdout
- cat stderr >&2
- exit 1
-}
-cat stdout
-cat stderr >&2
-grep 'whether my-python version is >= 9999\.9\.\.\. no *$' stdout
-grep '[Pp]ython interpreter is too old' stderr
+py_too_old my-python
:
+++ /dev/null
-#! /bin/sh
-# Copyright (C) 2003-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/>.
-
-# Test detection of missing Python.
-
-# Python is not required for this test.
-. ./defs || exit 1
-
-cat >>configure.ac <<EOF
-AM_PATH_PYTHON
-AC_OUTPUT
-EOF
-
-: > Makefile.am
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE --add-missing
-
-# Simulate no Python.
-./configure PYTHON=: 2>stderr && { cat stderr >&2; exit 1; }
-cat stderr >&2
-grep 'no suitable Python interpreter found' stderr
-
-# Again, but from the environment this time.
-env PYTHON=: ./configure 2>stderr && { cat stderr >&2; exit 1; }
-cat stderr >&2
-grep 'no suitable Python interpreter found' stderr
-
-:
+++ /dev/null
-#! /bin/sh
-# Copyright (C) 2003-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/>.
-
-# Test detection of missing Python.
-# Same as python4.sh, but requiring a version.
-
-# Python is not required for this test.
-. ./defs || exit 1
-
-cat >>configure.ac <<EOF
-# Hopefully the Python team will never release such a version.
-AM_PATH_PYTHON([9999.9])
-AC_OUTPUT
-EOF
-
-: > Makefile.am
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE --add-missing
-
-./configure >stdout 2>stderr && {
- cat stdout
- cat stderr >&2
- exit 1
-}
-cat stdout
-cat stderr >&2
-$EGREP 'checking for a Python interpreter with version >= 9999\.9\.\.\. no(ne)? *$' stdout
-grep 'no suitable Python interpreter found' stderr
-
-:
+++ /dev/null
-#! /bin/sh
-# Copyright (C) 2003-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/>.
-
-# Test detection of missing Python.
-# Same as 'python4.sh', but using a custom ACTION-IF-NOT-FOUND.
-
-# Python is not required for this test.
-. ./defs || exit 1
-
-cat >>configure.ac <<\EOF
-AM_PATH_PYTHON(,, [echo "$PYTHON" > py])
-AC_OUTPUT
-EOF
-
-: > Makefile.am
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE --add-missing
-
-# Simulate no Python.
-./configure PYTHON=:
-test x"$(cat py)" = x:
-
-:
+++ /dev/null
-#! /bin/sh
-# Copyright (C) 2003-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/>.
-
-# Test detection of missing Python.
-# Same as 'python6.sh', but requiring a version.
-
-# Python is not required for this test.
-. ./defs || exit 1
-
-cat >>configure.ac <<\EOF
-# Hopefully the Python team will never release such a version.
-AM_PATH_PYTHON([9999.9], [], [echo "$PYTHON" > py])
-AC_OUTPUT
-EOF
-
-: > Makefile.am
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE --add-missing
-
-./configure
-test x"$(cat py)" = x:
-
-:
+++ /dev/null
-#! /bin/sh
-# Copyright (C) 2003-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/>.
-
-# Test ACTION-IF-TRUE in AM_PATH_PYTHON.
-
-required=python
-. ./defs || exit 1
-
-cat >>configure.ac <<'EOF'
-# $PYTHON is supposed to be properly set in ACTION-IF-TRUE.
-AM_PATH_PYTHON(, [$PYTHON -V >py-version 2>&1])
-AC_OUTPUT
-EOF
-
-: > Makefile.am
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE --add-missing
-
-./configure
-grep '^Python [0-9]\.[0-9][0-9]*\.[0-9]' py-version
-
-: