From f81e127cb34373e583f68a927ef3f709ec02b0e9 Mon Sep 17 00:00:00 2001 From: genone Date: Wed, 30 May 2007 23:05:16 +0000 Subject: [PATCH] only add /usr/lib/portage/pym to python search path when necessary svn path=/; revision=407 --- trunk/ChangeLog | 2 ++ trunk/src/eclean/eclean | 7 +++++-- trunk/src/epkginfo/epkginfo | 13 +++++++++---- trunk/src/equery/equery | 6 +++++- trunk/src/gentoolkit/__init__.py | 7 +++++-- trunk/src/glsa-check/glsa-check | 6 +++++- trunk/src/glsa-check/glsa.py | 8 +++++--- 7 files changed, 36 insertions(+), 13 deletions(-) diff --git a/trunk/ChangeLog b/trunk/ChangeLog index 26f0131..0364285 100644 --- a/trunk/ChangeLog +++ b/trunk/ChangeLog @@ -4,6 +4,8 @@ within the same SLOT instead of the one with the smallest delta. * glsa-check: prefer visible upgrades to masked upgrades * equery: check for and warn about unknown options (bug 119674) + * equery,eclean,glsa-check,epkginfo: Only add /usr/lib/portage/pym + to python search path when necessary 2007-05-21: Paul Varner * echangelog: Add patch from genstef to fix issues from Bug 176337 diff --git a/trunk/src/eclean/eclean b/trunk/src/eclean/eclean index 1c9f848..27969b1 100644 --- a/trunk/src/eclean/eclean +++ b/trunk/src/eclean/eclean @@ -22,8 +22,11 @@ import time import getopt import fpformat import signal -sys.path.insert(0,'/usr/lib/portage/pym') -import portage +try: + import portage +except ImportError: + sys.path.insert(0, "/usr/lib/portage/pym") + import portage try: from portage.output import * except ImportError: diff --git a/trunk/src/epkginfo/epkginfo b/trunk/src/epkginfo/epkginfo index 7d4447f..ba28ad3 100755 --- a/trunk/src/epkginfo/epkginfo +++ b/trunk/src/epkginfo/epkginfo @@ -11,15 +11,20 @@ import os import sys -import portage +try: + import portage +except ImportError: + sys.path.insert(0, "/usr/lib/portage/pym") + import portage import re from stat import * -from output import * +try: + from portage.output import * +except ImportError: + from output import * from xml.sax import saxutils, make_parser, handler from xml.sax.handler import feature_namespaces -#sys.path.insert(0, "/usr/lib/portage/pym") - version="0.4.1" def getvar(pkg, var): diff --git a/trunk/src/equery/equery b/trunk/src/equery/equery index 3e65a60..cd699d0 100755 --- a/trunk/src/equery/equery +++ b/trunk/src/equery/equery @@ -23,7 +23,11 @@ sys.path.insert(0, "/usr/lib/portage/pym") sys.path.insert(0, "/usr/lib/gentoolkit/pym") import gentoolkit -import portage +try: + import portage +except ImportError: + sys.path.insert(0, "/usr/lib/portage/pym") + import portage import portage_checksum from portage_util import unique_array diff --git a/trunk/src/gentoolkit/__init__.py b/trunk/src/gentoolkit/__init__.py index 54ff41b..ecbea69 100644 --- a/trunk/src/gentoolkit/__init__.py +++ b/trunk/src/gentoolkit/__init__.py @@ -19,8 +19,11 @@ __description__ = "Gentoolkit Common Library" import os import sys -sys.path.insert(0, "/usr/lib/portage/pym") -import portage +try: + import portage +except ImportError: + sys.path.insert(0, "/usr/lib/portage/pym") + import portage import re from threading import Lock diff --git a/trunk/src/glsa-check/glsa-check b/trunk/src/glsa-check/glsa-check index c7aec45..71e7b06 100644 --- a/trunk/src/glsa-check/glsa-check +++ b/trunk/src/glsa-check/glsa-check @@ -6,7 +6,11 @@ import os import sys sys.path.insert(0, "/usr/lib/gentoolkit/pym") -sys.path.insert(0, "/usr/lib/portage/pym") +try: + import portage +except ImportError: + sys.path.insert(0, "/usr/lib/portage/pym") + import portage try: from portage.output import * diff --git a/trunk/src/glsa-check/glsa.py b/trunk/src/glsa-check/glsa.py index 32cde7e..60588d0 100644 --- a/trunk/src/glsa-check/glsa.py +++ b/trunk/src/glsa-check/glsa.py @@ -25,9 +25,11 @@ if sys.version_info[0:2] < (2,3): raise NotImplementedError("Python versions below 2.3 have broken XML code " \ +"and are not supported") -sys.path.insert(0, "/usr/lib/portage/pym") # to find portage.py - -import portage +try: + import portage +except ImportError: + sys.path.insert(0, "/usr/lib/portage/pym") + import portage # Note: the space for rgt and rlt is important !! opMapping = {"le": "<=", "lt": "<", "eq": "=", "gt": ">", "ge": ">=", -- 2.26.2