python-utils-r1.eclass: set PYTHON locally in python_export()
authorMichał Górny <mgorny@gentoo.org>
Sat, 7 Nov 2015 09:28:21 +0000 (10:28 +0100)
committerMichał Górny <mgorny@gentoo.org>
Wed, 11 Nov 2015 10:21:02 +0000 (11:21 +0100)
Ensure that PYTHON is always set inside python_export() for convenience.
If it wasn't requested for explicit export, make it a local variable.

eclass/python-utils-r1.eclass

index a80bdf436eb88e29c149f5a2d082b9d6b0c735bd..69166cfbf9db0348866b3e8fc458cb8369713031 100644 (file)
@@ -248,6 +248,12 @@ 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)
@@ -255,7 +261,7 @@ python_export() {
                                debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}"
                                ;;
                        PYTHON)
-                               export PYTHON=${EPREFIX}/usr/bin/${impl}
+                               # already exported above
                                debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
                                ;;
                        PYTHON_SITEDIR)