summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-12-11 23:09:09 +0000
committerZac Medico <zmedico@gentoo.org>2007-12-11 23:09:09 +0000
commitecefd74bdbe0ca305e05e35d9ed673738420e9f0 (patch)
treea852ebecb6fc3e16439b3d8f93d7f3b75234646a
parent5003a47d1b9cc09b21184eb5483633f84f5f8cfd (diff)
downloadportage-ecefd74bdbe0ca305e05e35d9ed673738420e9f0.tar.gz
portage-ecefd74bdbe0ca305e05e35d9ed673738420e9f0.tar.bz2
portage-ecefd74bdbe0ca305e05e35d9ed673738420e9f0.zip
First import the main portage module without legacy globals since it
is almost certain to succeed in that case. This provides access to the portage.exception namespace which is needed for later exception handling, like if portage.exception.PermissionDenied is raised when constructing the legacy global config instance. svn path=/main/trunk/; revision=8882
-rwxr-xr-xbin/portageq11
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/portageq b/bin/portageq
index eb0421e8b..0b7eab6fe 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -434,10 +434,19 @@ def main():
sys.stderr.flush()
sys.exit(os.EX_USAGE)
os.environ["ROOT"] = sys.argv[2]
+
+ # First import the main portage module without legacy globals since it
+ # is almost certain to succeed in that case. This provides access to
+ # the portage.exception namespace which is needed for later exception
+ # handling, like if portage.exception.PermissionDenied is raised when
+ # constructing the legacy global config instance.
+ os.environ["PORTAGE_LEGACY_GLOBALS"] = "false"
+ import portage
+ del os.environ["PORTAGE_LEGACY_GLOBALS"]
try:
global portage
try:
- import portage
+ reload(portage)
except ImportError:
from os import path as osp
sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))