Ensure that all Python processes use the same version of Python.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Fri, 13 Aug 2010 22:28:36 +0000 (00:28 +0200)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Fri, 13 Aug 2010 22:28:36 +0000 (00:28 +0200)
bin/ebuild-helpers/dohtml
bin/ebuild-helpers/portageq
bin/ebuild-ipc
bin/ebuild.sh
bin/misc-functions.sh
pym/portage/__init__.py
pym/portage/tests/ebuild/test_ipc_daemon.py

index e1ab7d97067370e47ef11bb7b87d1dbae895a914..6de730c6d3bca93433623c62e7bc7815de46e098 100755 (executable)
@@ -1,15 +1,13 @@
 #!/bin/bash
-# Copyright 2009 Gentoo Foundation
+# Copyright 2009-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
-# Set EPYTHON variable as empty so that dohtml.py doesn't try
-# to use potentially unsupported version of Python.
-EPYTHON= PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
-       "$PORTAGE_BIN_PATH/dohtml.py" "$@"
+PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
+       "$PORTAGE_PYTHON" "$PORTAGE_BIN_PATH/dohtml.py" "$@"
 
 ret=$?
 [[ $ret -ne 0 ]] && helpers_die "$0 failed"
index 3a06fdd68a44670b7be9d923abe8340442142dc8..8dee54c32616c6161ca6e3a1d30c4d478cdb1426 100755 (executable)
@@ -1,10 +1,8 @@
 #!/bin/bash
-# Copyright 2009 Gentoo Foundation
+# Copyright 2009-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
-# Set EPYTHON variable as empty so that portageq doesn't try
-# to use potentially unsupported version of Python.
-EPYTHON= PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
-       exec "$PORTAGE_BIN_PATH/portageq" "$@"
+PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
+       exec "$PORTAGE_PYTHON" "$PORTAGE_BIN_PATH/portageq" "$@"
index b828a35cd2c6bdaedb6ab2444166f0541625425a..45d0f15b8240dd8008ff48ceaee43dc2b4d41ae6 100755 (executable)
@@ -4,7 +4,5 @@
 
 PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
-# Set EPYTHON variable as empty so that ebuild-ipc.py doesn't try
-# to use potentially unsupported version of Python.
-EPYTHON= PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
-       exec "$PORTAGE_BIN_PATH/ebuild-ipc.py" "$@"
+PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
+       exec "$PORTAGE_PYTHON" "$PORTAGE_BIN_PATH/ebuild-ipc.py" "$@"
index 9af7e38671c6e54c2af6a1cb09fe6638739e20cf..6a2eeb1e62c81afb15c8d4d8a1c25077bc09185b 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"
@@ -164,10 +164,8 @@ has_version() {
                return $?
        fi
 
-       # Set EPYTHON variable as empty so that portageq doesn't try
-       # to use potentially unsupported version of Python.
-       EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-       "${PORTAGE_BIN_PATH}"/portageq has_version "${ROOT}" "$1"
+       PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
+       "$PORTAGE_PYTHON" "${PORTAGE_BIN_PATH}/portageq" has_version "${ROOT}" "$1"
        local retval=$?
        case "${retval}" in
                0)
@@ -187,10 +185,8 @@ portageq() {
                die "portageq calls are not allowed in the global scope"
        fi
 
-       # Set EPYTHON variable as empty so that portageq doesn't try
-       # to use potentially unsupported version of Python.
-       EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-       "${PORTAGE_BIN_PATH}/portageq" "$@"
+       PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
+       "$PORTAGE_PYTHON" "${PORTAGE_BIN_PATH}/portageq" "$@"
 }
 
 
@@ -211,10 +207,8 @@ best_version() {
                return $?
        fi
 
-       # Set EPYTHON variable as empty so that portageq doesn't try
-       # to use potentially unsupported version of Python.
-       EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-       "${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1"
+       PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
+       "$PORTAGE_PYTHON" "${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1"
        local retval=$?
        case "${retval}" in
                0)
@@ -1734,7 +1728,7 @@ filter_readonly_variables() {
                "
        fi
 
-       EPYTHON= "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed"
+       "$PORTAGE_PYTHON" "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed"
 }
 
 # @FUNCTION: preprocess_ebuild_env
index c965495b64ea7b8345c615848c33768844b57ae0..8207006ed0245a04bde1b36397581549a5a30030 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 #
 # Miscellaneous shell functions that make use of the ebuild env but don't need
@@ -489,7 +489,7 @@ install_qa_check() {
                done
                [[ $reset_debug = 1 ]] && set -x
                f=$(cat "${PORTAGE_LOG_FILE}" | \
-                       EPYTHON= "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed")
+                       "$PORTAGE_PYTHON" "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed")
                if [[ -n ${f} ]] ; then
 
                        # In the future this will be a forced "die". In preparation,
@@ -778,8 +778,8 @@ dyn_package() {
        tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${D}" . | \
                bzip2 -cf > "$PORTAGE_BINPKG_TMPFILE"
        assert "failed to pack binary package: '$PORTAGE_BINPKG_TMPFILE'"
-       EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-               "$PORTAGE_BIN_PATH"/xpak-helper.py recompose \
+       PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
+               "$PORTAGE_PYTHON" "$PORTAGE_BIN_PATH"/xpak-helper.py recompose \
                "$PORTAGE_BINPKG_TMPFILE" "$PORTAGE_BUILDDIR/build-info"
        if [ $? -ne 0 ]; then
                rm -f "${PORTAGE_BINPKG_TMPFILE}"
index a6760b2450c2ed1ba8a876f3322f917168609dbd..fb4c66cb1783ef4c9c5a380d3c8cdc8b3ca3eeca 100644 (file)
@@ -325,6 +325,8 @@ except (ImportError, OSError) as e:
 # END OF IMPORTS -- END OF IMPORTS -- END OF IMPORTS -- END OF IMPORTS -- END
 # ===========================================================================
 
+os.environ['PORTAGE_PYTHON'] = sys.executable
+
 def _ensure_default_encoding():
 
        default_encoding = sys.getdefaultencoding().lower().replace('-', '_')
index de548c6f14963311c8895c1a4d957964738da02f..4b7406deb850370ad95858415adbf0a3cf085e37 100644 (file)
@@ -1,6 +1,7 @@
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+import os
 import shutil
 import tempfile
 from portage import os
@@ -19,6 +20,7 @@ class IpcDaemonTestCase(TestCase):
                tmpdir = tempfile.mkdtemp()
                try:
                        env = {}
+                       env['PORTAGE_PYTHON'] = os.environ['PORTAGE_PYTHON']
                        env['PORTAGE_BIN_PATH'] = PORTAGE_BIN_PATH
                        env['PORTAGE_PYM_PATH'] = PORTAGE_PYM_PATH
                        env['PORTAGE_BUILDDIR'] = tmpdir