summaryrefslogtreecommitdiff
path: root/voctocore/lib/config.py
blob: 9201f3e1630f3186532edc579d5d608a9e3c0bd5 (plain)
  1. #!/usr/bin/python3
  2. import os.path
  3. from configparser import SafeConfigParser
  4. from lib.args import Args
  5. __all__ = ['Config']
  6. def getlist(self, section, option):
  7. return [x.strip() for x in self.get(section, option).split(',')]
  8. SafeConfigParser.getlist = getlist
  9. files = [
  10. 'default-config.ini',
  11. '/etc/voctomix.ini',
  12. os.path.expanduser('~/.voctomix.ini'),
  13. ]
  14. if Args.ini_file is not None:
  15. files.append(Args.ini_file)
  16. Config = SafeConfigParser()
  17. Config.read(files)