From de4e90c7ff6428672deb13cc9a2533f10d997067 Mon Sep 17 00:00:00 2001 From: duplo Date: Fri, 23 Jan 2009 18:36:02 +0000 Subject: [PATCH] Permit cyclic graphs in module dependencies git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2221 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BModulePage.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py index f2ecdeba..39cf91d9 100644 --- a/wizard/BModulePage.py +++ b/wizard/BModulePage.py @@ -169,19 +169,21 @@ class BModulePage(BWizardPage): QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) def selectDependencyCheck(self, module): - unsatisfied = [] + unsatisfied = set() modules = self._projectInfoRetrieve("MODULES") for dependency in modules[module]["depends"]: if not modules[dependency]["enabled"]: - unsatisfied.append(dependency) - unsatisfied += self.selectDependencyCheck(dependency) + unsatisfied |= set([dependency]) + if dependency not in unsatisfied: + unsatisfied |= self.selectDependencyCheck(dependency) return unsatisfied def unselectDependencyCheck(self, dependency): - unsatisfied = [] + unsatisfied = set() modules = self._projectInfoRetrieve("MODULES") for module, informations in modules.items(): if dependency in informations["depends"] and informations["enabled"]: - unsatisfied.append(module) - unsatisfied += self.unselectDependencyCheck(module) + unsatisfied |= set([module]) + if dependency not in unsatisfied: + unsatisfied |= self.unselectDependencyCheck(module) return unsatisfied \ No newline at end of file -- 2.25.1