diff options
Diffstat (limited to 'eclass/tests/python-utils-r1.sh')
-rwxr-xr-x | eclass/tests/python-utils-r1.sh | 94 |
1 files changed, 71 insertions, 23 deletions
diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 414ad5c53d6b..e883da38cead 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -1,8 +1,8 @@ #!/bin/bash -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=5 +EAPI=7 source tests-common.sh test_var() { @@ -71,17 +71,29 @@ fi test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7' test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7 -test_var EPYTHON python3_4 python3.4 -test_var PYTHON python3_4 /usr/bin/python3.4 -if [[ -x /usr/bin/python3.4 ]]; then - abiflags=$(/usr/bin/python3.4 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))') - test_var PYTHON_SITEDIR python3_4 "/usr/lib*/python3.4/site-packages" - test_var PYTHON_INCLUDEDIR python3_4 "/usr/include/python3.4${abiflags}" - test_var PYTHON_LIBPATH python3_4 "/usr/lib*/libpython3.4${abiflags}$(get_libname)" - test_var PYTHON_CONFIG python3_4 "/usr/bin/python3.4${abiflags}-config" +test_var EPYTHON python3_6 python3.6 +test_var PYTHON python3_6 /usr/bin/python3.6 +if [[ -x /usr/bin/python3.6 ]]; then + abiflags=$(/usr/bin/python3.6 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))') + test_var PYTHON_SITEDIR python3_6 "/usr/lib*/python3.6/site-packages" + test_var PYTHON_INCLUDEDIR python3_6 "/usr/include/python3.6${abiflags}" + test_var PYTHON_LIBPATH python3_6 "/usr/lib*/libpython3.6${abiflags}$(get_libname)" + test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config" fi -test_var PYTHON_PKG_DEP python3_4 '*dev-lang/python*:3.4' -test_var PYTHON_SCRIPTDIR python3_4 /usr/lib/python-exec/python3.4 +test_var PYTHON_PKG_DEP python3_6 '*dev-lang/python*:3.6' +test_var PYTHON_SCRIPTDIR python3_6 /usr/lib/python-exec/python3.6 + +test_var EPYTHON python3_7 python3.7 +test_var PYTHON python3_7 /usr/bin/python3.7 +if [[ -x /usr/bin/python3.7 ]]; then + abiflags=$(/usr/bin/python3.7 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))') + test_var PYTHON_SITEDIR python3_7 "/usr/lib/python3.7/site-packages" + test_var PYTHON_INCLUDEDIR python3_7 "/usr/include/python3.7${abiflags}" + test_var PYTHON_LIBPATH python3_7 "/usr/lib*/libpython3.7${abiflags}$(get_libname)" + test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config" +fi +test_var PYTHON_PKG_DEP python3_7 '*dev-lang/python*:3.7' +test_var PYTHON_SCRIPTDIR python3_7 /usr/lib/python-exec/python3.7 test_var EPYTHON jython2_7 jython2.7 test_var PYTHON jython2_7 /usr/bin/jython2.7 @@ -94,8 +106,8 @@ test_var PYTHON_SCRIPTDIR jython2_7 /usr/lib/python-exec/jython2.7 test_var EPYTHON pypy pypy test_var PYTHON pypy /usr/bin/pypy if [[ -x /usr/bin/pypy ]]; then - test_var PYTHON_SITEDIR pypy "/usr/lib*/pypy/site-packages" - test_var PYTHON_INCLUDEDIR pypy "/usr/lib*/pypy/include" + test_var PYTHON_SITEDIR pypy "/usr/lib*/pypy2.7/site-packages" + test_var PYTHON_INCLUDEDIR pypy "/usr/lib*/pypy2.7/include" fi test_var PYTHON_PKG_DEP pypy '*virtual/pypy*:0=' test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy @@ -103,8 +115,8 @@ test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy test_var EPYTHON pypy3 pypy3 test_var PYTHON pypy3 /usr/bin/pypy3 if [[ -x /usr/bin/pypy3 ]]; then - test_var PYTHON_SITEDIR pypy3 "/usr/lib*/pypy3/site-packages" - test_var PYTHON_INCLUDEDIR pypy3 "/usr/lib*/pypy3/include" + test_var PYTHON_SITEDIR pypy3 "/usr/lib*/pypy3.?/site-packages" + test_var PYTHON_INCLUDEDIR pypy3 "/usr/lib*/pypy3.?/include" fi test_var PYTHON_PKG_DEP pypy3 '*virtual/pypy3*:0=' test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3 @@ -117,7 +129,7 @@ test_is "python_is_python3 pypy3" 0 # generic shebangs test_fix_shebang '#!/usr/bin/python' python2.7 '#!/usr/bin/python2.7' -test_fix_shebang '#!/usr/bin/python' python3.4 '#!/usr/bin/python3.4' +test_fix_shebang '#!/usr/bin/python' python3.6 '#!/usr/bin/python3.6' test_fix_shebang '#!/usr/bin/python' pypy '#!/usr/bin/pypy' test_fix_shebang '#!/usr/bin/python' pypy3 '#!/usr/bin/pypy3' test_fix_shebang '#!/usr/bin/python' jython2.7 '#!/usr/bin/jython2.7' @@ -126,9 +138,9 @@ test_fix_shebang '#!/usr/bin/python' jython2.7 '#!/usr/bin/jython2.7' test_fix_shebang '#!/usr/bin/python2' python2.7 '#!/usr/bin/python2.7' test_fix_shebang '#!/usr/bin/python3' python2.7 FAIL test_fix_shebang '#!/usr/bin/python3' python2.7 '#!/usr/bin/python2.7' --force -test_fix_shebang '#!/usr/bin/python3' python3.4 '#!/usr/bin/python3.4' -test_fix_shebang '#!/usr/bin/python2' python3.4 FAIL -test_fix_shebang '#!/usr/bin/python2' python3.4 '#!/usr/bin/python3.4' --force +test_fix_shebang '#!/usr/bin/python3' python3.6 '#!/usr/bin/python3.6' +test_fix_shebang '#!/usr/bin/python2' python3.6 FAIL +test_fix_shebang '#!/usr/bin/python2' python3.6 '#!/usr/bin/python3.6' --force # pythonX.Y matching (those mostly test the patterns) test_fix_shebang '#!/usr/bin/python2.7' python2.7 '#!/usr/bin/python2.7' @@ -145,8 +157,8 @@ test_fix_shebang '#!/usr/bin/jython2.7' jython3.2 FAIL test_fix_shebang '#!/usr/bin/jython2.7' jython3.2 '#!/usr/bin/jython3.2' --force # fancy path handling -test_fix_shebang '#!/mnt/python2/usr/bin/python' python3.4 \ - '#!/mnt/python2/usr/bin/python3.4' +test_fix_shebang '#!/mnt/python2/usr/bin/python' python3.6 \ + '#!/mnt/python2/usr/bin/python3.6' test_fix_shebang '#!/mnt/python2/usr/bin/python2' python2.7 \ '#!/mnt/python2/usr/bin/python2.7' test_fix_shebang '#!/mnt/python2/usr/bin/env python' python2.7 \ @@ -168,9 +180,11 @@ test_is "_python_impl_supported python2_7" 0 test_is "_python_impl_supported python3_1" 1 test_is "_python_impl_supported python3_2" 1 test_is "_python_impl_supported python3_3" 1 -test_is "_python_impl_supported python3_4" 0 +test_is "_python_impl_supported python3_4" 1 test_is "_python_impl_supported python3_5" 0 test_is "_python_impl_supported python3_6" 0 +test_is "_python_impl_supported python3_7" 0 +test_is "_python_impl_supported python3_8" 0 test_is "_python_impl_supported pypy1_8" 1 test_is "_python_impl_supported pypy1_9" 1 test_is "_python_impl_supported pypy2_0" 1 @@ -178,6 +192,40 @@ test_is "_python_impl_supported pypy" 0 test_is "_python_impl_supported pypy3" 0 test_is "_python_impl_supported jython2_7" 0 +# check _python_impl_matches behavior +test_is "_python_impl_matches python2_7 -2" 0 +test_is "_python_impl_matches python3_6 -2" 1 +test_is "_python_impl_matches python3_7 -2" 1 +test_is "_python_impl_matches pypy -2" 0 +test_is "_python_impl_matches pypy3 -2" 1 +test_is "_python_impl_matches python2_7 -3" 1 +test_is "_python_impl_matches python3_6 -3" 0 +test_is "_python_impl_matches python3_7 -3" 0 +test_is "_python_impl_matches pypy -3" 1 +test_is "_python_impl_matches pypy3 -3" 0 +test_is "_python_impl_matches python2_7 -2 python3_6" 0 +test_is "_python_impl_matches python3_6 -2 python3_6" 0 +test_is "_python_impl_matches python3_7 -2 python3_6" 1 +test_is "_python_impl_matches pypy -2 python3_6" 0 +test_is "_python_impl_matches pypy3 -2 python3_6" 1 +test_is "_python_impl_matches python2_7 pypy3 -2 python3_6" 0 +test_is "_python_impl_matches python3_6 pypy3 -2 python3_6" 0 +test_is "_python_impl_matches python3_7 pypy3 -2 python3_6" 1 +test_is "_python_impl_matches pypy pypy3 -2 python3_6" 0 +test_is "_python_impl_matches pypy3 pypy3 -2 python3_6" 0 +set -f +test_is "_python_impl_matches python2_7 pypy*" 1 +test_is "_python_impl_matches python3_6 pypy*" 1 +test_is "_python_impl_matches python3_7 pypy*" 1 +test_is "_python_impl_matches pypy pypy*" 0 +test_is "_python_impl_matches pypy3 pypy*" 0 +test_is "_python_impl_matches python2_7 python*" 0 +test_is "_python_impl_matches python3_6 python*" 0 +test_is "_python_impl_matches python3_7 python*" 0 +test_is "_python_impl_matches pypy python*" 1 +test_is "_python_impl_matches pypy3 python*" 1 +set +f + rm "${tmpfile}" texit |