1 # Copyright (c) 2012 The Chromium OS Authors.
3 # SPDX-License-Identifier: GPL-2.0+
12 """Set up the buildman settings module by reading config files
15 config_fname: Config filename to read ('' for default)
20 settings = ConfigParser.SafeConfigParser()
23 if config_fname == '':
24 config_fname = '%s/.buildman' % os.getenv('HOME')
26 settings.read(config_fname)
29 settings.readfp(StringIO.StringIO(data))
31 def GetItems(section):
32 """Get the items from a section of the config.
35 section: name of section to retrieve
38 List of (name, value) tuples for the section
41 return settings.items(section)
42 except ConfigParser.NoSectionError as e:
47 def SetItem(section, tag, value):
48 """Set an item and write it back to the settings file"""
52 settings.set(section, tag, value)
53 if config_fname is not None:
54 with open(config_fname, 'w') as fd: