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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 5
0
    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')
Exemplo n.º 6
0
    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')
Exemplo n.º 7
0
    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")