aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/archive-conf4
-rwxr-xr-xbin/binhost-snapshot4
-rwxr-xr-xbin/clean_locks4
-rwxr-xr-xbin/dispatch-conf4
-rwxr-xr-xbin/ebuild4
-rwxr-xr-xbin/ebuild-ipc.py20
-rwxr-xr-xbin/egencache4
-rwxr-xr-xbin/emaint4
-rwxr-xr-xbin/emerge5
-rwxr-xr-xbin/env-update4
-rwxr-xr-xbin/fixpackages4
-rwxr-xr-xbin/glsa-check4
-rwxr-xr-xbin/portageq22
-rwxr-xr-xbin/quickpkg4
-rwxr-xr-xbin/regenworld4
-rwxr-xr-xbin/repoman4
16 files changed, 54 insertions, 45 deletions
diff --git a/bin/archive-conf b/bin/archive-conf
index f73ca425e..59350a0f8 100755
--- a/bin/archive-conf
+++ b/bin/archive-conf
@@ -14,8 +14,8 @@ from __future__ import print_function
import sys
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
diff --git a/bin/binhost-snapshot b/bin/binhost-snapshot
index c2204f03d..3a346431e 100755
--- a/bin/binhost-snapshot
+++ b/bin/binhost-snapshot
@@ -13,8 +13,8 @@ except ImportError:
from urlparse import urlparse
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
from portage.util._argparse import ArgumentParser
diff --git a/bin/clean_locks b/bin/clean_locks
index 3e969f2c6..13af06197 100755
--- a/bin/clean_locks
+++ b/bin/clean_locks
@@ -6,8 +6,8 @@ from __future__ import print_function
import sys, errno
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
diff --git a/bin/dispatch-conf b/bin/dispatch-conf
index 4b0c0ac8f..fb0a8afb4 100755
--- a/bin/dispatch-conf
+++ b/bin/dispatch-conf
@@ -17,8 +17,8 @@ from stat import ST_GID, ST_MODE, ST_UID
from random import random
import atexit, re, shutil, stat, sys
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
from portage import os
diff --git a/bin/ebuild b/bin/ebuild
index 8f4b103c6..02ee02298 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -38,8 +38,8 @@ signal.signal(debug_signum, debug_signal)
import io
import os
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
from portage import os
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
diff --git a/bin/egencache b/bin/egencache
index c14be936b..e3660580f 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -41,8 +41,8 @@ import textwrap
import re
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
from portage import os, _encodings, _unicode_encode, _unicode_decode
diff --git a/bin/emaint b/bin/emaint
index aeeb18328..a634c0ead 100755
--- a/bin/emaint
+++ b/bin/emaint
@@ -26,8 +26,8 @@ except KeyboardInterrupt:
sys.exit(1)
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
from portage.emaint.main import emaint_main
diff --git a/bin/emerge b/bin/emerge
index 7773f7fe1..43cfdcddb 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -36,9 +36,8 @@ try:
signal.signal(debug_signum, debug_signal)
from os import path as osp
- pym_path = osp.join(osp.dirname(osp.dirname(
- osp.realpath(__file__))), "pym")
- sys.path.insert(0, pym_path)
+ if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
portage._disable_legacy_globals()
diff --git a/bin/env-update b/bin/env-update
index 7651ef9c1..c43459bd7 100755
--- a/bin/env-update
+++ b/bin/env-update
@@ -26,8 +26,8 @@ if len(sys.argv) > 1:
usage(1)
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
diff --git a/bin/fixpackages b/bin/fixpackages
index cec0030f2..8a0c4448d 100755
--- a/bin/fixpackages
+++ b/bin/fixpackages
@@ -8,8 +8,8 @@ import os
import sys
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
from portage import os
diff --git a/bin/glsa-check b/bin/glsa-check
index 972679a80..94dea7398 100755
--- a/bin/glsa-check
+++ b/bin/glsa-check
@@ -8,8 +8,8 @@ import sys
import codecs
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
from portage import os
diff --git a/bin/portageq b/bin/portageq
index 79818f679..4d5cc197a 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -23,18 +23,22 @@ except KeyboardInterrupt:
import os
import types
-# 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))
- del 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
-sys.path.insert(0, pym_path)
import portage
portage._internal_caller = True
from portage import os
diff --git a/bin/quickpkg b/bin/quickpkg
index 035131e98..cf75791b5 100755
--- a/bin/quickpkg
+++ b/bin/quickpkg
@@ -11,8 +11,8 @@ import sys
import tarfile
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
from portage import os
diff --git a/bin/regenworld b/bin/regenworld
index 32e8e5c33..e07424df6 100755
--- a/bin/regenworld
+++ b/bin/regenworld
@@ -6,8 +6,8 @@ from __future__ import print_function
import sys
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
from portage import os
diff --git a/bin/repoman b/bin/repoman
index 5a6ee5b1f..ddd2e9252 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -32,8 +32,8 @@ except ImportError:
from urlparse import urlparse
from os import path as osp
-pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
-sys.path.insert(0, pym_path)
+if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
portage._disable_legacy_globals()