Move PORTAGE_PYTHON setting to doebuild_environment() so that it
authorZac Medico <zmedico@gentoo.org>
Sat, 14 Aug 2010 17:01:55 +0000 (10:01 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 14 Aug 2010 17:01:55 +0000 (10:01 -0700)
doesn't pollute os.environ.

pym/portage/__init__.py
pym/portage/package/ebuild/doebuild.py
pym/portage/process.py
pym/portage/tests/ebuild/test_ipc_daemon.py

index fb4c66cb1783ef4c9c5a380d3c8cdc8b3ca3eeca..a6760b2450c2ed1ba8a876f3322f917168609dbd 100644 (file)
@@ -325,8 +325,6 @@ 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 e85785528d7cc6ce2e413f57f0fc6031be97a71b..7400da7c08549a015ba4c07b5af4d020886d5021 100644 (file)
@@ -108,6 +108,9 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings,
 
        mysettings["PORTAGE_MASTER_PID"] = str(os.getpid())
 
+       # Set requested Python interpreter for Portage helpers.
+       mysettings['PORTAGE_PYTHON'] = sys.executable
+
        # We are disabling user-specific bashrc files.
        mysettings["BASH_ENV"] = INVALID_ENV_FILE
 
index 331e88059f535ae935f992d38eb77c18e17479e6..aed727167f84f1c34018956cd9b0c9c3d3f5ad57 100644 (file)
@@ -375,9 +375,6 @@ def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask,
                os.umask(umask)
        if pre_exec:
                pre_exec()
-       
-       # Set requested Python interpreter for Portage helpers.
-       env['PORTAGE_PYTHON'] = sys.executable
 
        # And switch to the new process.
        os.execve(binary, myargs, env)
index b03409d0f6eb3421f808ea4ae1747282da5dc86b..f0d072aede7bb985fa63bcb93064c5b0ff687ede 100644 (file)
@@ -1,6 +1,7 @@
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+import sys
 import shutil
 import tempfile
 from portage import os
@@ -19,7 +20,7 @@ class IpcDaemonTestCase(TestCase):
                tmpdir = tempfile.mkdtemp()
                try:
                        env = {}
-                       env['PORTAGE_PYTHON'] = os.environ['PORTAGE_PYTHON']
+                       env['PORTAGE_PYTHON'] = sys.executable
                        env['PORTAGE_BIN_PATH'] = PORTAGE_BIN_PATH
                        env['PORTAGE_PYM_PATH'] = PORTAGE_PYM_PATH
                        env['PORTAGE_BUILDDIR'] = tmpdir