def get_publish_properties(target): publish_properties = props_by_repo.get(target.provides.repo) if not publish_properties: publish_properties = Properties() with open(target.provides.repo.push_db) as props: publish_properties.load(props) props_by_repo[target.provides.repo] = publish_properties return publish_properties
def test_dump(self): props = OrderedDict() props['a'] = 1 props['b'] = '''2 ''' props['c'] = ' 3 : =' out = Compatibility.StringIO() Properties.dump(props, out) self.assertEquals('a=1\nb=2\\\n\nc=\\ 3\\ \\:\\ \\=\n', out.getvalue())
def test_dump(self): props = OrderedDict() props['a'] = 1 props['b'] = '''2 ''' props['c'] =' 3 : =' out = Compatibility.StringIO() Properties.dump(props, out) self.assertEquals('a=1\nb=2\\\n\nc=\\ 3\\ \\:\\ \\=\n', out.getvalue())
def _find_checkstyle_suppressions(props, root_dir): props = Properties.load(props) # Magic - we know the root.dir property is defined elsewhere, so we seed it. props['root.dir'] = root_dir def resolve_props(value): def replace_symbols(matchobj): return props[matchobj.group(1)] symbol_parser = re.compile("\${([^}]+)\}") while symbol_parser.match(value): value = symbol_parser.sub(replace_symbols, value) return value files = resolve_props(props['checkstyle.suppression.files']) return files.split(',')
def dump(self, path): """Saves the pushdb as a properties file to the given path.""" with open(path, 'w') as props: Properties.dump(self._props, props)
def load(path): """Loads a pushdb maintained in a properties file at the given path.""" with open(path, 'r') as props: properties = Properties.load(props) return PushDb(properties)
def assertLoaded(self, contents, expected): self.assertEquals(expected, Properties.load(contents))
def get_publish_properties(target): if target.provides.repo not in props_by_repo: with open(target.provides.repo.push_db) as props: props_by_repo[target.provides.repo] = Properties.load(props) return props_by_repo.get(target.provides.repo)