* t/ax/am-test-lib.sh (require_tool): Here.
* t/python-too-old.sh: And here.
* t/python-vars.sh: And here.
* t/python-virtualenv.sh: And here. Also add some sanity
checks while at it.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
;;
python)
# Python doesn't support --version, it has -V
- echo "$me: running python -V"
- python -V || skip_all_ "python interpreter not available"
+ PYTHON=${PYTHON-python}
+ echo "$me: running $PYTHON -V"
+ $PYTHON -V || skip_all_ "python interpreter not available"
;;
ro-dir)
# Skip this test case if read-only directories aren't supported
grep '[Pp]ython interpreter is too old' stderr
}
+saved_PYTHON=$PYTHON; export saved_PYTHON
PYTHON=; unset PYTHON
cat > configure.ac <<END
mkdir bin
cat > bin/my-python << 'END'
#! /bin/sh
-exec python ${1+"$@"}
+exec $saved_PYTHON ${1+"$@"}
END
chmod a+x bin/my-python
PATH=$(pwd)/bin$PATH_SEPARATOR$PATH
# In case the user's config.site defines pythondir or pyexecdir.
CONFIG_SITE=/dev/null; export CONFIG_SITE
-PYTHON=python
-
# Update the definition below if the documentation changes.
# Note that the value of the 'pythondir' and 'pyexecdir' variables can
# vary among different python installations, so we need more relaxed
# In case the user's config.site defines pythondir or pyexecdir.
CONFIG_SITE=/dev/null; export CONFIG_SITE
+py_version_pre=$($PYTHON -V)
+
# Skip the test if a proper virtualenv cannot be created.
-virtualenv --verbose virtenv && test -f virtenv/bin/activate \
+virtualenv -p"$PYTHON" --verbose virtenv && test -f virtenv/bin/activate \
|| skip_ "couldn't create python virtual environment"
# Activate the virtualenv.
framework_failure_ "can't activate python virtual environment"
fi
+py_version_post=$(python -V)
+
+# Sanity check.
+test "$py_version_pre" = "$py_version_post"
+
cwd=$(pwd) || fatal_ "getting current working directory"
py_version=$(python -c 'import sys; print("%u.%u" % tuple(sys.version_info[:2]))')
py_site=$VIRTUAL_ENV/lib/python$py_version/site-packages