+2011-02-14 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ python: fix spurious failure in tests
+ * tests/python-vars.test: Ignore cached values from config.site
+ by exporting CONFIG_SITE=/dev/null. Be laxer in matching the
+ expected values of output variables `pythondir' and `pyexecdir',
+ since they can change quite unpredictably among different python
+ installations. Also, avoid "hyping" debugging output, thus
+ offering smaller trace output and more informative diff.
+ Report and suggestions by Ralf Wildenhues.
+ * tests/python-virtualenv.test: Require python, since we call it
+ even after the virtualenv has been deactivated. Ignore cached
+ values from config.site by exporting CONFIG_SITE=/dev/null.
+
2011-02-06 Stefano Lattarini <stefano.lattarini@gmail.com>
python: extend and improve tests, fix minor glitches
set -e
+# In case the user's config.site defines pythondir or pyexecdir.
+CONFIG_SITE=/dev/null; export CONFIG_SITE
+
PYTHON=python
-# Update these if the documentation changes.
+# 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
+# and ad-hoc checks for them. Also, more proper "functional" checks
+# on them should be done in the `python-virtualenv.test' test.
PYTHON_VERSION=`$PYTHON -c 'import sys; print(sys.version[:3])'` || Exit 1
PYTHON_PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'` || Exit 1
PYTHON_EXEC_PREFIX='${exec_prefix}'
PYTHON_PREFIX='${prefix}'
-pythondir="\${prefix}/lib/python$PYTHON_VERSION/site-packages"
-pyexecdir="\${exec_prefix}/lib/python$PYTHON_VERSION/site-packages"
pkgpythondir="\${pythondir}/$me"
pkgpyexecdir="\${pyexecdir}/$me"
pyvars='PYTHON_VERSION PYTHON_PLATFORM PYTHON_PREFIX PYTHON_EXEC_PREFIX
- pythondir pyexecdir pkgpythondir pkgpyexecdir'
+ pkgpythondir pkgpyexecdir'
cat >> configure.in << 'END'
-AC_CONFIG_FILES([vars-got])
+AC_CONFIG_FILES([vars-got pythondir pyexecdir])
AM_PATH_PYTHON
AC_OUTPUT
END
.PHONY: test-in test-am
test-in:
+ cat pythondir
+ case `cat pythondir` in '$${prefix}'/*);; *) exit 1;; esac
+ cat pyexecdir
+ case `cat pyexecdir` in '$${exec_prefix}'/*);; *) exit 1;; esac
cat $(srcdir)/vars-exp
cat $(builddir)/vars-got
diff $(srcdir)/vars-exp $(builddir)/vars-got
+
+## Note: this target's rules will be extended in the "for" loop below.
+test-am:
+ case '$(pythondir)' in '$(prefix)'/*);; *) exit 1;; esac
+ case '$(pyexecdir)' in '$(exec_prefix)'/*);; *) exit 1;; esac
END
-echo > vars-exp
-echo > vars-got.in
-echo test-am: >> Makefile.am
+echo @pythondir@ > pythondir.in
+echo @pyexecdir@ > pyexecdir.in
+
+: > vars-exp
+: > vars-got.in
for var in $pyvars; do
eval val=\$$var
- (echo "### $var ###" && echo "$val" && echo) >> vars-exp
- (echo "### $var ###" && echo "@$var@" && echo) >> vars-got.in
+ echo "var=$val" >> vars-exp
+ echo "var=@$var@" >> vars-got.in
echo "${tab}test x'\$($var)' = x'$val'" >> Makefile.am
done
$ACLOCAL
$AUTOMAKE --add-missing
-for var in $pyvars; do
+for var in pythondir pyexecdir $pyvars; do
grep "^$var *=" Makefile.in
done
# Check that python support can work well with virtualenvs.
# This test also works as a mild stress-test on the python support.
-required=virtualenv
+required='python virtualenv'
. ./defs || Exit 1
set -e
+# In case the user's config.site defines pythondir or pyexecdir.
+CONFIG_SITE=/dev/null; export CONFIG_SITE
+
# Skip the test if a proper virtualenv cannot be created.
virtualenv --verbose virtenv || Exit 77
test -f virtenv/bin/activate || Exit 77