| # Copyright (c) 2012 The Chromium OS Authors. |
| # SPDX-License-Identifier: GPL-2.0+ |
| """Set up the buildman settings module by reading config files |
| config_fname: Config filename to read ('' for default) |
| settings = ConfigParser.SafeConfigParser() |
| config_fname = '%s/.buildman' % os.getenv('HOME') |
| settings.read(config_fname) |
| settings.readfp(StringIO.StringIO(data)) |
| """Get the items from a section of the config. |
| section: name of section to retrieve |
| List of (name, value) tuples for the section |
| return settings.items(section) |
| except ConfigParser.NoSectionError as e: |
| def SetItem(section, tag, value): |
| """Set an item and write it back to the settings file""" |
| settings.set(section, tag, value) |
| if config_fname is not None: |
| with open(config_fname, 'w') as fd: |