summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-12-09 22:02:01 -0800
committerZac Medico <zmedico@gentoo.org>2011-12-09 22:02:01 -0800
commitbd8514843e2dac56c59a566b335c89d486ad894b (patch)
tree3014b981fc468bc61efe0279c0d47b7fb875eea7 /pym
parent49689816166eee3d4fd4d2b1b9932398f3835341 (diff)
downloadportage-bd8514843e2dac56c59a566b335c89d486ad894b.tar.gz
portage-bd8514843e2dac56c59a566b335c89d486ad894b.tar.bz2
portage-bd8514843e2dac56c59a566b335c89d486ad894b.zip
Use portage.const.EPREFIX more.
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py2
-rw-r--r--pym/portage/const.py4
-rw-r--r--pym/portage/data.py2
-rw-r--r--pym/portage/dispatch_conf.py4
-rw-r--r--pym/portage/tests/repoman/test_simple.py2
-rw-r--r--pym/portage/util/env_update.py2
6 files changed, 7 insertions, 9 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 27353a1e8..bdfb4e29d 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -505,6 +505,8 @@ def create_trees(config_root=None, target_root=None, trees=None, env=None):
if env is None:
env = os.environ
eprefix = env.get("__PORTAGE_TEST_EPREFIX")
+ if eprefix is None:
+ eprefix = portage.const.EPREFIX
settings = config(config_root=config_root, target_root=target_root,
env=env, _eprefix=eprefix)
settings.lock()
diff --git a/pym/portage/const.py b/pym/portage/const.py
index 5003b155c..553dfc534 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -154,10 +154,6 @@ if "__PORTAGE_TEST_EPREFIX" in os.environ:
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
# ===========================================================================
diff --git a/pym/portage/data.py b/pym/portage/data.py
index fe390a130..53af6b966 100644
--- a/pym/portage/data.py
+++ b/pym/portage/data.py
@@ -82,7 +82,7 @@ def _get_global(k):
secpass = 0
if uid == 0:
secpass = 2
- elif "__PORTAGE_TEST_EPREFIX" in os.environ:
+ elif portage.const.EPREFIX:
secpass = 2
#Discover the uid and gid of the portage user/group
try:
diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py
index abd3ac141..7f407fffe 100644
--- a/pym/portage/dispatch_conf.py
+++ b/pym/portage/dispatch_conf.py
@@ -39,8 +39,8 @@ def diffstatusoutput_len(cmd):
return (1, 1)
def read_config(mandatory_opts):
- eprefix = os.environ.get("__PORTAGE_TEST_EPREFIX", "/")
- config_path = os.path.join(eprefix, "etc/dispatch-conf.conf")
+ eprefix = portage.const.EPREFIX
+ config_path = os.path.join(eprefix or os.sep, "etc/dispatch-conf.conf")
loader = KeyValuePairFileLoader(config_path, None)
opts, errors = loader.load()
if not opts:
diff --git a/pym/portage/tests/repoman/test_simple.py b/pym/portage/tests/repoman/test_simple.py
index 6c8a61c5b..b3186d7b4 100644
--- a/pym/portage/tests/repoman/test_simple.py
+++ b/pym/portage/tests/repoman/test_simple.py
@@ -184,7 +184,7 @@ class SimpleRepomanTestCase(TestCase):
pythonpath = PORTAGE_PYM_PATH + pythonpath
env = {
- "__REPOMAN_TEST_EPREFIX" : eprefix,
+ "__PORTAGE_TEST_EPREFIX" : eprefix,
"DISTDIR" : distdir,
"GENTOO_COMMITTER_NAME" : committer_name,
"GENTOO_COMMITTER_EMAIL" : committer_email,
diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 7879ed9aa..e8507b3f7 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -50,7 +50,7 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
target_root = portage.settings["ROOT"]
target_eroot = portage.settings['EROOT']
else:
- eprefix = os.environ.get("__PORTAGE_TEST_EPREFIX", "")
+ eprefix = portage.const.EPREFIX
target_eroot = os.path.join(target_root,
eprefix.lstrip(os.sep))
target_eroot = target_eroot.rstrip(os.sep) + os.sep