From: W. Trevor King Date: Mon, 6 Jun 2011 23:07:56 +0000 (-0400) Subject: Fix gentoolkit import pth in portage_utils.py. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f7b96912eeb82ee4021a6fc45620c0b71b8ae765;p=g-pypi.git 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 --- 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