aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2014-09-20 05:48:23 +0200
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2014-09-20 05:48:23 +0200
commit5e3e84b4fc4dc75d520b8e0e894811e3e2c88f56 (patch)
tree163fb7a2d00d1060191766184ba2bb080d103bfb /bin/ebuild-ipc.py
parent_solve_..slot_conflicts: fix bug #522084 (diff)
downloadportage-5e3e84b4fc4dc75d520b8e0e894811e3e2c88f56.tar.gz
portage-5e3e84b4fc4dc75d520b8e0e894811e3e2c88f56.tar.bz2
portage-5e3e84b4fc4dc75d520b8e0e894811e3e2c88f56.zip
Update sys.path in scripts only when using not installed instance of Portage.
Modules of installed instance of Portage are now placed in standard location, which is included in default sys.path.
Diffstat (limited to 'bin/ebuild-ipc.py')
-rwxr-xr-xbin/ebuild-ipc.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/bin/ebuild-ipc.py b/bin/ebuild-ipc.py
index 00337ee22..3e6d90c61 100755
--- a/bin/ebuild-ipc.py
+++ b/bin/ebuild-ipc.py
@@ -24,15 +24,21 @@ else:
signal.signal(debug_signum, debug_signal)
-# Avoid sandbox violations after python upgrade.
-pym_path = os.path.join(os.path.dirname(
- os.path.dirname(os.path.realpath(__file__))), "pym")
+if os.path.isfile(os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), ".portage_not_installed")):
+ pym_paths = [os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "pym")]
+ sys.path.insert(0, pym_paths[0])
+else:
+ import distutils.sysconfig
+ pym_paths = [os.path.join(distutils.sysconfig.get_python_lib(), x) for x in ("_emerge", "portage")]
+# Avoid sandbox violations after Python upgrade.
if os.environ.get("SANDBOX_ON") == "1":
sandbox_write = os.environ.get("SANDBOX_WRITE", "").split(":")
- if pym_path not in sandbox_write:
- sandbox_write.append(pym_path)
- os.environ["SANDBOX_WRITE"] = \
- ":".join(filter(None, sandbox_write))
+ for pym_path in pym_paths:
+ if pym_path not in sandbox_write:
+ sandbox_write.append(pym_path)
+ os.environ["SANDBOX_WRITE"] = ":".join(filter(None, sandbox_write))
+ del pym_path, sandbox_write
+del pym_paths
import portage
portage._internal_caller = True