Signed-off-by: Michał Górny <[email protected]>
---
eclass/distutils-r2.eclass | 3 +--
eclass/python-r2.eclass | 3 +--
eclass/python-utils-r2.eclass | 21 +++++++--------------
eclass/tests/python-utils-r2.sh | 12 ++++++------
4 files changed, 15 insertions(+), 24 deletions(-)
diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass
index 3863e0679e5b..6a52e261498c 100644
--- a/eclass/distutils-r2.eclass
+++ b/eclass/distutils-r2.eclass
@@ -729,8 +729,7 @@ _distutils-r2_wrap_scripts() {
local path=${1}
local bindir=${2}
- local PYTHON_SCRIPTDIR
- _python_export PYTHON_SCRIPTDIR
+ local PYTHON_SCRIPTDIR=$(python_get_scriptdir)
local f python_files=() non_python_files=()
diff --git a/eclass/python-r2.eclass b/eclass/python-r2.eclass
index c5881a21d8cd..f7a92c500317 100644
--- a/eclass/python-r2.eclass
+++ b/eclass/python-r2.eclass
@@ -756,8 +756,7 @@ python_replicate_script() {
_python_replicate_script() {
local _PYTHON_FIX_SHEBANG_QUIET=1
- local PYTHON_SCRIPTDIR
- _python_export PYTHON_SCRIPTDIR
+ local PYTHON_SCRIPTDIR=$(python_get_scriptdir)
(
exeopts -m 0755
diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index 7c438e59aa6a..8486ee901cd9 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -295,11 +295,6 @@ _python_export() {
export PYTHON_PKG_DEP
debug-print "${FUNCNAME}: PYTHON_PKG_DEP =
${PYTHON_PKG_DEP}"
;;
- PYTHON_SCRIPTDIR)
- local dir
- export
PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl}
- debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR =
${PYTHON_SCRIPTDIR}"
- ;;
*)
die "_python_export: unknown variable ${var}"
esac
@@ -443,16 +438,15 @@ python_get_PYTHON_CONFIG() {
}
# @FUNCTION: python_get_scriptdir
-# @USAGE: [<impl>]
# @DESCRIPTION:
-# Obtain and print the script install path for the given
-# implementation. If no implementation is provided, ${EPYTHON} will
-# be used.
+# Obtain and print the script install path for ${EPYTHON}.
python_get_scriptdir() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
- _python_export "${@}" PYTHON_SCRIPTDIR
- echo "${PYTHON_SCRIPTDIR}"
+ local out=${EPREFIX}/usr/lib/python-exec/${impl}
+ debug-print "${FUNCNAME} -> ${out}"
+ echo "${out}"
}
# @FUNCTION: _python_ln_rel
@@ -619,9 +613,8 @@ python_newexe() {
local f=${1}
local newfn=${2}
- local PYTHON_SCRIPTDIR d
- _python_export PYTHON_SCRIPTDIR
- d=${PYTHON_SCRIPTDIR#${EPREFIX}}
+ local PYTHON_SCRIPTDIR=$(python_get_scriptdir)
+ local d=${PYTHON_SCRIPTDIR#${EPREFIX}}
(
dodir "${wrapd}"
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index 0b41a7bcdb53..b4b37efe179b 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -84,7 +84,7 @@ if [[ -x /usr/bin/python2.7 ]]; then
test_get LIBS python2.7 "*-lpython2.7*"
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_get scriptdir python2.7 /usr/lib/python-exec/python2.7
test_var EPYTHON python3_6 python3.6
test_var PYTHON python3_6 /usr/bin/python3.6
@@ -98,7 +98,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
test_get LIBS python3.6 "*-lpython3.6*"
fi
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_get 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
@@ -112,7 +112,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
test_get LIBS python3.7 "*-lpython3.7*"
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_get 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
@@ -120,7 +120,7 @@ if [[ -x /usr/bin/jython2.7 ]]; then
test_get sitedir jython2.7 /usr/share/jython-2.7/Lib/site-packages
fi
test_var PYTHON_PKG_DEP jython2_7 '*dev-java/jython*:2.7'
-test_var PYTHON_SCRIPTDIR jython2_7 /usr/lib/python-exec/jython2.7
+test_get scriptdir jython2.7 /usr/lib/python-exec/jython2.7
test_var EPYTHON pypy pypy
test_var PYTHON pypy /usr/bin/pypy
@@ -129,7 +129,7 @@ if [[ -x /usr/bin/pypy ]]; then
test_get includedir pypy "/usr/lib*/pypy2.7/include"
fi
test_var PYTHON_PKG_DEP pypy '*dev-python/pypy*:0='
-test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy
+test_get scriptdir pypy /usr/lib/python-exec/pypy
test_var EPYTHON pypy3 pypy3
test_var PYTHON pypy3 /usr/bin/pypy3
@@ -138,7 +138,7 @@ if [[ -x /usr/bin/pypy3 ]]; then
test_get includedir pypy3 "/usr/lib*/pypy3.?/include"
fi
test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0='
-test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
+test_get scriptdir pypy3 /usr/lib/python-exec/pypy3
test_is "python_is_python3 python2.7" 1
test_is "python_is_python3 python3.2" 0
--
2.25.1