1 # Parse lightcards config file
5 from pathlib import Path
9 class ConfigException(BaseException):
10 def __init__(self, message):
11 self.message = message
12 print(f"lightcards: {self.message}")
18 local_xdg = f"{os.path.expanduser('~')}/{os.environ.get('XDG_CACHE_HOME')}/lightcards/config.py"
19 local = f"{os.path.expanduser('~')}/.config/lightcards/config.py"
20 world = "/etc/lightcards/config.py"
21 world_default = "/usr/share/doc/lightcards/config.py"
23 f"{os.path.expanduser('~')}/.local/share/doc/lightcards/config.py"
26 if os.path.exists(file):
28 elif os.path.exists(local_xdg):
30 elif os.path.exists(local):
32 elif os.path.exists(world):
34 elif os.path.exists(world_default):
36 elif os.path.exists(local_default):
42 exec(Path(str(find_file(file))).read_text(), {}, config)