From bd16f7cdfb70b559202708aea31916ce07076874 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 7 Jun 2011 18:29:09 -0400 Subject: [PATCH] Don't clear the category after the initial package. My previous implementation actually set the category to the empty string, which is definately not what we want. The current implementation checks both the specified category and dev-python when looking for required packages, and defaults to generating all required packages in the specified category. The literal set syntax `{a,b,...}` requires Python >= 2.7, but that's the current default in Portage, so anyone running g-pypi should have it already. --- g_pypi/cli.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/g_pypi/cli.py b/g_pypi/cli.py index 8bc61ee..78eb79c 100755 --- a/g_pypi/cli.py +++ b/g_pypi/cli.py @@ -131,6 +131,7 @@ class GPyPI(object): #ebuild already exists #self.logger.debug("Creating dep tree...") no_deps = self.config.getboolean('options', 'no_deps') + category = self.config.get('options', 'category') while len(self.tree): (project_name, version) = self.tree.pop(0) #self.logger.debug(self.tree) @@ -141,14 +142,23 @@ class GPyPI(object): #print "REQUIRES", requires if requires: for req in requires: - if no_deps or ebuild_exists("dev-python/%s" % req.project_name.lower()): - if not no_deps: - self.logger.info("Skipping dependency (exists): %s" % req.project_name) + depcat = None + for cat in {category, 'dev-python'}: + if ebuild_exists('%s/%s' % ( + category, req.project_name.lower())): + depcat = cat + break + if depcat: + self.logger.info( + 'skipping dependency (exists): %s/%s' % ( + depcat, req.project_name)) + elif no_deps: + self.logger.info( + 'skipping dependency: %s' % req.project_name) else: self.add_dep(req.project_name) - #Only force overwriting and category on first ebuild created, not dependencies + #Only force overwriting on first ebuild created, not dependencies self.config.setboolean('options', 'overwrite', False) - self.config.set('options', 'category', '') def add_dep(self, project_name): '''Add dependency''' -- 2.26.2