From 95a5b8da343d78db2389419f57f753476b5d2bf1 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 6 Jun 2011 20:55:30 -0400 Subject: [PATCH] Rework portage_utils' find_packages to work with old and new gentoolkits. --- g_pypi/portage_utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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: -- 2.26.2