summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-10-21 18:32:08 -0700
committerZac Medico <zmedico@gentoo.org>2010-10-21 18:32:08 -0700
commitb1ff977673d720aa173bc64daa49dfef957fb4ee (patch)
treefbc640b835eea1f947e3e856c1e5380cff7776e7
parent72298bcb48e432011d56143525adb642bd18f1d4 (diff)
downloadportage-b1ff977673d720aa173bc64daa49dfef957fb4ee.tar.gz
portage-b1ff977673d720aa173bc64daa49dfef957fb4ee.tar.bz2
portage-b1ff977673d720aa173bc64daa49dfef957fb4ee.zip
lock-helper.py: use PORTAGE_PYM_PATH for safety
-rwxr-xr-xbin/lock-helper.py2
-rw-r--r--pym/_emerge/AsynchronousLock.py2
-rw-r--r--pym/portage/__init__.py1
-rw-r--r--pym/portage/dbapi/vartree.py1
4 files changed, 5 insertions, 1 deletions
diff --git a/bin/lock-helper.py b/bin/lock-helper.py
index 5c332b2af..469d3a9da 100755
--- a/bin/lock-helper.py
+++ b/bin/lock-helper.py
@@ -2,7 +2,9 @@
# Copyright 2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+import os
import sys
+sys.path.insert(0, os.environ['PORTAGE_PYM_PATH'])
import portage
def main(args):
diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLock.py
index bce81ed5c..d72add4f1 100644
--- a/pym/_emerge/AsynchronousLock.py
+++ b/pym/_emerge/AsynchronousLock.py
@@ -171,7 +171,7 @@ class _LockProcess(AbstractPollTask):
self._proc = SpawnProcess(
args=[portage._python_interpreter,
os.path.join(portage._bin_path, 'lock-helper.py'), self.path],
- env=os.environ,
+ env=dict(os.environ, PORTAGE_PYM_PATH=portage._pym_path),
fd_pipes={0:out_pr, 1:in_pw, 2:sys.stderr.fileno()},
scheduler=self.scheduler)
self._proc.addExitListener(self._proc_exit)
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 2dedde49b..1e6f21b22 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -328,6 +328,7 @@ except (ImportError, OSError) as e:
_python_interpreter = os.path.realpath(sys.executable)
_bin_path = PORTAGE_BIN_PATH
+_pym_path = PORTAGE_PYM_PATH
def _ensure_default_encoding():
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 18a3c0d7c..571b344f3 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3829,6 +3829,7 @@ class dblink(object):
shutil.copytree(var_orig, var_new, symlinks=True)
os.chmod(var_new, dir_perms)
portage._bin_path = settings['PORTAGE_BIN_PATH']
+ portage._pym_path = settings['PORTAGE_PYM_PATH']
os.chmod(base_path_tmp, dir_perms)
# This serves so pre-load the modules.
_preload_elog_modules(self.settings)