From: W. Trevor King Date: Tue, 7 Jun 2011 00:55:30 +0000 (-0400) Subject: Rework portage_utils' find_packages to work with old and new gentoolkits. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=95a5b8da343d78db2389419f57f753476b5d2bf1;p=g-pypi.git Rework portage_utils' find_packages to work with old and new gentoolkits. --- diff --git a/g_pypi/portage_utils.py b/g_pypi/portage_utils.py index c9042d8..1a27bd6 100644 --- a/g_pypi/portage_utils.py +++ b/g_pypi/portage_utils.py @@ -31,7 +31,13 @@ try: except ImportError: # earlier versions in '/usr/lib/gentoolkit/pym' sys.path.append(os.path.join('/usr', 'lib', 'gentoolkit', 'pym')) import gentoolkit -import gentoolkit.query + +try: + import gentoolkit.query # gentoolkit since 0.3.0 + def find_packages(key): + return gentoolkit.query.Query(cat_pkg).find() +except ImportError: # earlier versions + from gentoolkit.helpers import find_packages __docformat__ = 'restructuredtext' @@ -107,7 +113,7 @@ def ebuild_exists(cat_pkg): @returns: True if ebuild exists, False if no ebuild exists """ - pkgs = gentoolkit.query.Query(cat_pkg).find() + pkgs = find_packages(cat_pkg) if len(pkgs): return True else: