From 42fae1c5d12eb4729aee9ee0b4556a1f0ff7dd68 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 22 Aug 2016 14:39:07 +0200 Subject: [PATCH] tests: Fix python2 use --- tests/libtest.sh | 2 +- tests/make-test-runtime.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/libtest.sh b/tests/libtest.sh index 923732c9..90f64304 100644 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -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 diff --git a/tests/make-test-runtime.sh b/tests/make-test-runtime.sh index 9295fd3c..461d36e8 100755 --- a/tests/make-test-runtime.sh +++ b/tests/make-test-runtime.sh @@ -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