6 __author__ = "Oleg Broytman <phd@phdru.name>"
7 __copyright__ = "Copyright (C) 2014 PhiloSoft Design"
8 __license__ = "GNU GPL"
10 __all__ = ['xsetbg_conf']
13 from ConfigParser import SafeConfigParser
16 if 'XDG_CONFIG_HOME' in os.environ:
17 config_dirs.append(os.environ['XDG_CONFIG_HOME'])
18 if 'XDG_CONFIG_DIRS' in os.environ:
19 config_dirs.extend(os.environ['XDG_CONFIG_DIRS'].split(':'))
20 home_config = os.path.expanduser('~/.config')
21 if home_config not in config_dirs:
22 config_dirs.append(home_config)
23 config_dirs.append(os.path.dirname(os.path.abspath(__file__)))
26 xsetbg_conf_file = os.path.join(d, 'xsetbg.conf')
27 if os.path.exists(xsetbg_conf_file):
28 xsetbg_conf = SafeConfigParser()
29 xsetbg_conf.read(xsetbg_conf_file)
32 raise RuntimeError("Cannot find xsetbg.conf; searched %s", config_dirs)
34 if __name__ == '__main__':
35 print "Config dirs:", config_dirs
36 print "Config file:", xsetbg_conf_file