Expand sys.executable earlier, so that change of sys.executable symlink
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Mon, 16 Aug 2010 19:22:14 +0000 (21:22 +0200)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Mon, 16 Aug 2010 19:22:14 +0000 (21:22 +0200)
between starting main Portage process and starting ebuild.sh process
doesn't affect ebuild.sh subprocesses.

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

index a6534b12df6c9d0dec4eb05c0d57080521847783..b2cbc0f0e3e166e58a069ba4ead83161422aa9f6 100644 (file)
@@ -325,6 +325,8 @@ except (ImportError, OSError) as e:
 # END OF IMPORTS -- END OF IMPORTS -- END OF IMPORTS -- END OF IMPORTS -- END
 # ===========================================================================
 
+_python_interpreter = os.path.realpath(sys.executable)
+
 def _ensure_default_encoding():
 
        default_encoding = sys.getdefaultencoding().lower().replace('-', '_')
index 0b580e6d58ffdd9c6ff1d86ac4d56a6ac562d494..2451cea196cba8f4765905d7a9513149eacbdbf4 100644 (file)
@@ -105,7 +105,7 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings,
        mysettings["PORTAGE_MASTER_PID"] = str(os.getpid())
 
        # Set requested Python interpreter for Portage helpers.
-       mysettings['PORTAGE_PYTHON'] = os.path.realpath(sys.executable)
+       mysettings['PORTAGE_PYTHON'] = portage._python_interpreter
 
        # We are disabling user-specific bashrc files.
        mysettings["BASH_ENV"] = INVALID_ENV_FILE
index 8d40bf7ead6904b248b34b8316d2fd215f2ecbdd..6e5c28a36d558e7e7c8da9b753fb23bd62a2ca7b 100644 (file)
@@ -3,6 +3,7 @@
 
 import sys
 from portage import os
+from portage import _python_interpreter
 from portage import _shell_quote
 from portage.const import EBUILD_SH_BINARY
 from portage.package.ebuild.config import config
@@ -40,7 +41,7 @@ class DoebuildSpawnTestCase(TestCase):
                                metadata=metadata, root_config=root_config,
                                type_name='ebuild')
                        settings.setcpv(pkg)
-                       settings['PORTAGE_PYTHON'] = os.path.realpath(sys.executable)
+                       settings['PORTAGE_PYTHON'] = _python_interpreter
                        settings['PORTAGE_BUILDDIR'] = os.path.join(
                                settings['PORTAGE_TMPDIR'], cpv)
                        settings['T'] = os.path.join(
index a17760394f340bea98f0675b8f11a59aa3edb90a..0a9a9a929bdc8c480963526e88a69bc6226493a4 100644 (file)
@@ -1,10 +1,10 @@
 # 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
+from portage import _python_interpreter
 from portage.tests import TestCase
 from portage.const import PORTAGE_BIN_PATH
 from portage.const import PORTAGE_PYM_PATH
@@ -28,7 +28,7 @@ class IpcDaemonTestCase(TestCase):
                        if 'PORTAGE_GRPNAME' in os.environ:
                                env['PORTAGE_GRPNAME'] = os.environ['PORTAGE_GRPNAME']
 
-                       env['PORTAGE_PYTHON'] = os.path.realpath(sys.executable)
+                       env['PORTAGE_PYTHON'] = _python_interpreter
                        env['PORTAGE_BIN_PATH'] = PORTAGE_BIN_PATH
                        env['PORTAGE_PYM_PATH'] = PORTAGE_PYM_PATH
                        env['PORTAGE_BUILDDIR'] = tmpdir