From 9fd2fbb571fccae2e1f58daeeef348a91023cde5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 8 Dec 2011 13:15:55 -0800 Subject: 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). --- pym/portage/const.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'pym/portage/const.py') 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 # =========================================================================== -- cgit v1.2.3-1-g7c22