def clean_paths(seq): pred = lambda p: os.path.exists(p) and os.path.isdir(p) for e in filter(lambda p: not pred(p), seq): warn("Directory %s should be included into the search paths but does not exists or is a directory", e) return filter(pred, seq)
def validate(self): r = True for a in self.full_alphabet_dir() + self.full_binary_dir() + self.full_python_dir(): a = path(a) if not (a.exists() and a.isdir()): r = False warn("Directory %s is included by %s in %s, but does not exists." % (a, self.name, self.base_path)) return r
def resolve_packages(self): """recursive resolving packages""" packs = [] for t, p in self._resolve_items: p = path(p).expanduser() if t == 'package': packs.append(Package.create(self.base_path / p)) else: try: r = Repository.from_file(self.base_path / p) if r.active: packs += r.resolve_packages() except FileNotFoundError: warn("Could not load imported repository %s at %s", (self.base_path/p).abspath(), self.base_path) return packs