config.py

changeset 79
b075b3db3044
parent 74
4f56142e7497
--- a/config.py	Sun Jan 28 11:04:52 2018 +0000
+++ b/config.py	Sun Jan 28 11:38:01 2018 +0000
@@ -10,9 +10,11 @@
 import logging
 import platform
 from functools import reduce
-import borgend
+import loggers
+import branding
+import locations
 
-logger=borgend.logger.getChild(__name__)
+logger=loggers.get(__name__)
 
 #
 # Defaults
@@ -39,20 +41,6 @@
 }
 
 #
-# Locations
-#
-
-if platform.system()!='Darwin':
-    import xdg
-    cfgfile=os.path.join(xdg.XDG_CONFIG_HOME, borgend.appname, "config.yaml")
-    logs_dir=os.path.join(xdg.XDG_DATA_HOME, borgend.appname, "logs")
-else:
-    import rumps
-    __base=rumps.application_support(borgend.appname)
-    cfgfile=os.path.join(__base, "config.yaml")
-    logs_dir=os.path.join(__base, "logs")
-
-#
 # Type checking etc.
 #
 
@@ -156,12 +144,12 @@
 
     return out
 
-if not (os.path.exists(cfgfile) and os.path.isfile(cfgfile)):
-    raise SystemExit("Configuration file required: %s" % cfgfile)
+if not (os.path.exists(locations.cfgfile) and os.path.isfile(locations.cfgfile)):
+    raise SystemExit("Configuration file required: %s" % locations.cfgfile)
 
-logger.info("Reading configuration %s missing" % cfgfile)
+logger.info("Reading configuration %s missing" % locations.cfgfile)
 
-with io.open(cfgfile, 'r') as file:
+with io.open(locations.cfgfile, 'r') as file:
     settings=expand_env(yaml.load(file), os.environ);
 
 #

mercurial