summaryrefslogtreecommitdiffstats
path: root/pym/portage/const.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-12-08 13:15:55 -0800
committerZac Medico <zmedico@gentoo.org>2011-12-08 13:15:55 -0800
commit9fd2fbb571fccae2e1f58daeeef348a91023cde5 (patch)
tree449feedbcb1d16c049d94bda995d16db38fb3e83 /pym/portage/const.py
parent4b4ad3579e83fc59be55a1304d483fbbbc95f6f4 (diff)
downloadportage-9fd2fbb571fccae2e1f58daeeef348a91023cde5.tar.gz
portage-9fd2fbb571fccae2e1f58daeeef348a91023cde5.tar.bz2
portage-9fd2fbb571fccae2e1f58daeeef348a91023cde5.zip
Add portage.const.EPREFIX, for prefix installs.
The EPREFIX for the current install is hardcoded here, but access to this constant should be minimal, in favor of access via the EPREFIX setting of a config instance (since it's possible to contruct a config instance with a different EPREFIX).
Diffstat (limited to 'pym/portage/const.py')
-rw-r--r--pym/portage/const.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/pym/portage/const.py b/pym/portage/const.py
index 3dad36a2e..5eeebe130 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -140,6 +140,24 @@ MANIFEST2_HASH_DEFAULTS = frozenset(["SHA1", "SHA256", "RMD160"])
MANIFEST2_REQUIRED_HASH = "SHA256"
MANIFEST2_IDENTIFIERS = ("AUX", "MISC", "DIST", "EBUILD")
+
+# The EPREFIX for the current install is hardcoded here, but access to this
+# constant should be minimal, in favor of access via the EPREFIX setting of
+# a config instance (since it's possible to contruct a config instance with
+# a different EPREFIX). Therefore, the EPREFIX constant should *NOT* be used
+# in the definition of any other contstants within this file.
+EPREFIX=""
+
+# pick up EPREFIX from the environment if set
+if "__PORTAGE_TEST_EPREFIX" in os.environ:
+ EPREFIX = os.environ["__PORTAGE_TEST_EPREFIX"]
+ if EPREFIX:
+ EPREFIX = os.path.normpath(EPREFIX)
+
+elif EPREFIX:
+ # Propagate the constant to other portage code which uses this variable.
+ os.environ["__PORTAGE_TEST_EPREFIX"] = EPREFIX
+
# ===========================================================================
# END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT
# ===========================================================================