def merge_properties(paths): """Merges properties from the given paths.""" properties = DotProperties() for path in paths: try: properties.update(path) except IOError as e: if e.errno != errno.ENOENT: raise e return properties
def merge_properties(filename, srcdirs): """Merges properties from the given file in the given source directories.""" properties = DotProperties() for srcdir in srcdirs: path = mozpath.join(srcdir, filename) try: properties.update(path) except IOError: # Ignore non-existing files continue return properties
def merge_properties(filename, srcdirs): """Merges properties from the given file in the given source directories.""" properties = DotProperties() for srcdir in srcdirs: path = mozpath.join(srcdir, filename) try: properties.update(path) except IOError: # Ignore non-existing files continue return properties
def merge_properties(paths): """Merges properties from the given paths.""" properties = DotProperties() for path in paths: try: properties.update(path) except IOError as e: if e.errno == errno.ENOENT: # Ignore non-existant files. continue return properties
def test_update(self): contents = StringIO(''' old=old value key=value ''') p = DotProperties(contents) self.assertEqual(p.get('old'), 'old value') self.assertEqual(p.get('key'), 'value') new_contents = StringIO(''' key=new value ''') p.update(new_contents) self.assertEqual(p.get('old'), 'old value') self.assertEqual(p.get('key'), 'new value')
def test_update(self): contents = StringIO(''' old=old value key=value ''') p = DotProperties(contents) self.assertEqual(p.get('old'), 'old value') self.assertEqual(p.get('key'), 'value') new_contents = StringIO(''' key=new value ''') p.update(new_contents) self.assertEqual(p.get('old'), 'old value') self.assertEqual(p.get('key'), 'new value')
def test_update(self): contents = StringIO(""" old=old value key=value """) p = DotProperties(contents) self.assertEqual(p.get("old"), "old value") self.assertEqual(p.get("key"), "value") new_contents = StringIO(""" key=new value """) p.update(new_contents) self.assertEqual(p.get("old"), "old value") self.assertEqual(p.get("key"), "new value")