commit:     85b6221484774c97ba06fcac3451c711b3046b88
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  7 09:28:21 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Nov 11 10:21:02 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85b62214

python-utils-r1.eclass: set PYTHON locally in python_export()

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 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index a80bdf4..69166cf 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -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)

Reply via email to