tests: Fix python2 use

This commit is contained in:
Alexander Larsson
2016-08-22 14:39:07 +02:00
parent fcffefee26
commit 42fae1c5d1
2 changed files with 5 additions and 3 deletions

View File

@@ -242,7 +242,7 @@ skip_without_bwrap () {
}
skip_without_python2 () {
if ! test -f /usr/bin/python2 || ! test -f /usr/lib*/python2.7/os.py ; then
if ! test -f /usr/bin/python2 || ! /usr/bin/python2 -c "import sys; sys.exit(0 if sys.version_info >= (2, 7) else 1)" ; then
echo "1..0 # SKIP this test requires /usr/bin/python2 (2.7) support"
exit 0
fi

View File

@@ -24,15 +24,17 @@ for i in $@; do
mkdir -p ${DIR}/usr/lib/python2.7/lib-dynload
# This is a hardcoded minimal set of modules we need in the current tests.
# Pretty hacky stuff. Add modules as needed.
PYDIR=/usr/lib/python2.7
if test -d /usr/lib64/python2.7; then PYDIR=/usr/lib64/python2.7; fi
for py in site os stat posixpath genericpath warnings \
linecache types UserDict abc _abcoll \
_weakrefset copy_reg traceback sysconfig \
re sre_compile sre_parse sre_constants \
_sysconfigdata ; do
cp /usr/lib*/python2.7/$py.py ${DIR}/usr/lib/python2.7
cp ${PYDIR}/$py.py ${DIR}/usr/lib/python2.7
done
for so in _locale strop ; do
cp /usr/lib*/python2.7/lib-dynload/${so}module.so ${DIR}/usr/lib/python2.7/lib-dynload
cp ${PYDIR}/lib-dynload/${so}module.so ${DIR}/usr/lib/python2.7/lib-dynload
done
fi
done