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)
24 xsetbg_dir = os.path.dirname(os.path.abspath(__file__))
25 config_dirs.append(xsetbg_dir)
28 xsetbg_conf_file = os.path.join(d, 'xsetbg.conf')
29 if os.path.exists(xsetbg_conf_file):
30 xsetbg_conf = SafeConfigParser()
31 xsetbg_conf.read(xsetbg_conf_file)
34 raise RuntimeError("Cannot find xsetbg.conf; searched %s", config_dirs)
36 if __name__ == '__main__':
37 print "Config dirs:", config_dirs
38 print "Config file:", xsetbg_conf_file