def read(self, filepath='.'): filepath = path(filepath).abspath() if filepath.isdir(): filepath /= self.filename content = Format.read(str(filepath)) return self.parse(content, None)
def uniqpath(root, prefix=''): if not isinstance(root, path): root = path(root) while True: candidate = root / ('%s%s' % (prefix, str(uuid4()).replace('-', '')[:8])) if not candidate.exists(): return candidate
def __init__(self, buildfile): if not isinstance(buildfile, path): buildfile = path(buildfile) self.buildfile = buildfile self.components = {} if self.buildfile.exists(): for line in self.buildfile.bytes().strip().split('\n'): line = line.strip() if line: component, version = line.split(' ', 1) self.components[component] = version