7 from ConfigParser import SafeConfigParser
9 __all__ = ['xsetbg_conf']
12 if 'XDG_CONFIG_HOME' in os.environ:
13 config_dirs.append(os.environ['XDG_CONFIG_HOME'])
14 if 'XDG_CONFIG_DIRS' in os.environ:
15 config_dirs.extend(os.environ['XDG_CONFIG_DIRS'].split(':'))
16 home_config = os.path.expanduser('~/.config')
17 if home_config not in config_dirs:
18 config_dirs.append(home_config)
20 xsetbg_dir = os.path.dirname(os.path.abspath(__file__))
21 config_dirs.append(xsetbg_dir)
24 xsetbg_conf_file = os.path.join(d, 'xsetbg.conf')
25 if os.path.exists(xsetbg_conf_file):
26 xsetbg_conf = SafeConfigParser()
27 xsetbg_conf.read(xsetbg_conf_file)
30 raise RuntimeError("Cannot find xsetbg.conf; searched %s", config_dirs)
32 if __name__ == '__main__':
33 print "Config dirs:", config_dirs
34 print "Config file:", xsetbg_conf_file