From f7b96912eeb82ee4021a6fc45620c0b71b8ae765 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 6 Jun 2011 19:07:56 -0400 Subject: [PATCH] Fix gentoolkit import pth in portage_utils.py. gentoolkit since 0.3.0 has been installed into the usual site-packages directory, so there shouldn't be any need to monkey with sys.path. If the user is running an older version that is under /usr/lib/gentoolkit, we fall back to that. Appending it to sys.path (vs. prepending) allows us to override its location with PYTHONPATH: PYTHONPATH=".:$HOME/src/gentoolkit/pym" nosetests tests/test_portage_utils.py --- g_pypi/portage_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/g_pypi/portage_utils.py b/g_pypi/portage_utils.py index 7bca6d3..c9042d8 100644 --- a/g_pypi/portage_utils.py +++ b/g_pypi/portage_utils.py @@ -26,8 +26,11 @@ except ImportError: #portage <= 2.1 from portage import portage_dep -sys.path.insert(0, "/usr/lib/gentoolkit/pym") -import gentoolkit +try: + import gentoolkit # gentoolkit since 0.3.0 are installed as usual +except ImportError: # earlier versions in '/usr/lib/gentoolkit/pym' + sys.path.append(os.path.join('/usr', 'lib', 'gentoolkit', 'pym')) + import gentoolkit import gentoolkit.query -- 2.26.2