def __removePrerequisites(self, event): self.__relationsToRestore = dict() # pylint: disable-msg=W0201 for task in self.items: prerequisites, dependencies = task.prerequisites(), task.dependencies() self.__relationsToRestore[task] = prerequisites, dependencies task.removeTaskAsDependencyOf(prerequisites, event=event) task.removeTaskAsPrerequisiteOf(dependencies, event=event) task.setPrerequisites([], event=event) task.setDependencies([], event=event)
def addPrerequisitesAndDependencies(tasks): for task in tasks: dummyPrerequisites = task.prerequisites() prerequisites = set() for dummyPrerequisite in dummyPrerequisites: prerequisites.add(tasksById[dummyPrerequisite.id]) task.setPrerequisites(prerequisites) for prerequisite in prerequisites: prerequisite.addDependencies([task]) addPrerequisitesAndDependencies(task.children())
def addPrerequisitesAndDependencies(tasks, event): for task in tasks: if task.isDeleted(): # Don't restore prerequisites and dependencies for deleted # tasks task.setPrerequisites([], event=event) continue dummyPrerequisites = task.prerequisites() prerequisites = set() for dummyPrerequisite in dummyPrerequisites: try: prerequisites.add(tasksById[dummyPrerequisite.id]) except KeyError: # Release 1.2.11 and older have a bug where tasks can # have prerequisites listed that don't exist anymore pass task.setPrerequisites(prerequisites, event=event) for prerequisite in prerequisites: prerequisite.addDependencies([task], event=event) addPrerequisitesAndDependencies(task.children(), event)
def __restorePrerequisites(self, event): for task, (prerequisites, dependencies) in self.__relationsToRestore.items(): task.addTaskAsDependencyOf(prerequisites, event=event) task.addTaskAsPrerequisiteOf(dependencies, event=event) task.setPrerequisites(prerequisites, event=event) task.setDependencies(dependencies, event=event)