From c381b3773715f651b2a3fc1dda3b2f89cb4bd771 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 17 Jul 2002 04:44:53 +0000 Subject: confuse concepts even more at least as far as naming is concerned. we need to use the depsDict refcounting even with optional packages, because an optional package can be a dependency of another optional package though its kind of weird to do so. --- comps.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'comps.py') diff --git a/comps.py b/comps.py index e69d29199..60d2195ba 100644 --- a/comps.py +++ b/comps.py @@ -373,6 +373,13 @@ class Component: self.newpkgDict[p] = (PKGTYPE_OPTIONAL, 1) p.registerComponent(self) self.pkgDict[p] = None + # up the refcount since, otherwise, when you have things + # which are deps as optional also, Bad Things Happen (tm) + if p.name in self.depsDict.keys(): + self.depsDict[p.name] = self.depsDict[p.name] + 1 + else: + self.depsDict[p.name] = 1 + self.updateDependencyCountForAddition(p) elif isinstance(p, Component): print "selecting component" @@ -391,6 +398,12 @@ class Component: p.unregisterComponent(self) if self.pkgDict.has_key(p): del self.pkgDict[p] + # dec the refcount since, otherwise, when you have things + # which are deps as optional also, Bad Things Happen (tm) + if p.name in self.depsDict.keys(): + self.depsDict[p.name] = self.depsDict[p.name] - 1 + if self.depsDict[p.name] == 0: + del self.depsDict[p.name] self.updateDependencyCountForRemoval(p) elif isinstance(p, Component): p.unselect(forInclude = 1, toplevel = 0) -- cgit