summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2015-11-12 15:12:07 +0100
committerMichał Górny <mgorny@gentoo.org>2015-11-12 17:03:16 +0100
commita3535feb5a32831754d99cc82018d0726bdca8c2 (patch)
tree651fa1242d6a2def0d1009d5b28f0c9e1a4bc5dc /eclass/python-utils-r1.eclass
parentapp-emulation/lxd: clean up old (diff)
downloadgentoo-a3535feb5a32831754d99cc82018d0726bdca8c2.tar.gz
gentoo-a3535feb5a32831754d99cc82018d0726bdca8c2.tar.bz2
gentoo-a3535feb5a32831754d99cc82018d0726bdca8c2.zip
python-utils-r1.eclass: python_export(), always respect PYTHON
Respect pre-set PYTHON in python_export(), unless a new value is requested. Bail out if PYTHON is neither set, nor requested.
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass12
1 files changed, 5 insertions, 7 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index b55cc8be1266..6ff1dd17bab2 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -265,12 +265,6 @@ python_export() {
esac
debug-print "${FUNCNAME}: implementation: ${impl}"
- # make sure it doesn't leave our function unless desired
- if ! has PYTHON "${@}"; then
- local PYTHON
- fi
- export PYTHON=${EPREFIX}/usr/bin/${impl}
-
for var; do
case "${var}" in
EPYTHON)
@@ -278,10 +272,11 @@ python_export() {
debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}"
;;
PYTHON)
- # already exported above
+ export PYTHON=${EPREFIX}/usr/bin/${impl}
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
PYTHON_SITEDIR)
+ [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
# sysconfig can't be used because:
# 1) pypy doesn't give site-packages but stdlib
# 2) jython gives paths with wrong case
@@ -289,6 +284,7 @@ python_export() {
debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
;;
PYTHON_INCLUDEDIR)
+ [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
export PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())')
debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
@@ -298,6 +294,7 @@ python_export() {
fi
;;
PYTHON_LIBPATH)
+ [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
export PYTHON_LIBPATH=$("${PYTHON}" -c 'import os.path, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR"), sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") else "")')
debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
@@ -342,6 +339,7 @@ python_export() {
case "${impl}" in
python*)
+ [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
flags=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")')
val=${PYTHON}${flags}-config
;;