def readSchedulers(dirs, loader, schedulerWrapper, initArgs, paths, makeErrorLoggerWithPrefix): def loadScheduler(path, name): newInitArgs = initArgs._replace( logger=makeErrorLoggerWithPrefix("sibt ({0})".format(name)), varDir=makeSchedulerVarDir(paths, name)) ret = loadSchedulerFromModule(loader, path, name, newInitArgs) return schedulerWrapper(ret) return ConfigurableList(collectFilesInDirs(dirs, lambda path, fileName: LazyConfigurable(fileName, lambda: loadScheduler(path, fileName))))
def _readInstancesFromBaseRule(self, baseRulePath, baseRuleName): if any(baseRuleName.endswith(extension) for extension in self.extensionsToIgnore): return None instances = collectFilesInDirs([self.enabledDir], functools.partial( self._buildLazyInstance, baseRulePath, baseRuleName, True)) if len(instances) == 0: disabledRule = self._buildLazyInstance(baseRulePath, baseRuleName, False, baseRulePath, "@" + baseRuleName) if disabledRule is not None: return [disabledRule] return instances
def read(self): return [rule for instancesList in collectFilesInDirs([self.rulesDir], self._readInstancesFromBaseRule) for rule in instancesList]
def createHashbangAwareProcessRunner(runnersDir, processRunner): runners = collectFilesInDirs([runnersDir], lambda path, fileName: Runner(fileName, path)) return HashbangAwareProcessRunner(runners, processRunner)
def readSynchronizers(dirs, processRunner): def load(path, fileName): return LazyConfigurable(fileName, lambda: loadSynchronizer(processRunner, path, fileName)) return ConfigurableList(collectFilesInDirs(dirs, load))