Use platform package to detect whether to:

Sun, 21 Jan 2018 22:43:57 +0000

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sun, 21 Jan 2018 22:43:57 +0000
changeset 43
8f3ac19f11b6
parent 42
00accd11978b
child 44
ac449729a896

Use platform package to detect whether to:
* rumps vs. xdg for configuration file location, and
* try to display a tray icon

README.md file | annotate | diff | comparison | revisions
borgend.py file | annotate | diff | comparison | revisions
config.py file | annotate | diff | comparison | revisions
--- a/README.md	Sun Jan 21 22:38:01 2018 +0000
+++ b/README.md	Sun Jan 21 22:43:57 2018 +0000
@@ -1,6 +1,7 @@
 # Borgend
 
-This is a retrying and queuing scheduler as well as a MacOS tray icon for [BorgBackup](https://borgbackup.readthedocs.io/en/stable/).
+This is a retrying scheduler as well as a MacOS tray icon for [BorgBackup](https://borgbackup.readthedocs.io/en/stable/).
+If you are not on MacOS, no tray icon will be displayed, but you can still use Borgend as a retrying scheduler.
 
 The lead author is Tuomo Valkonen (<tuomov@iki.fi>).
 
@@ -42,10 +43,6 @@
 
     security add-generic-password -a my-borg-backup -s borg-backup -w [PASSWORD]
 
-### Running on non-Mac OS systems
-
-You will need to start Borgend with the `--no-tray` option.
-
 
 ## License
 
--- a/borgend.py	Sun Jan 21 22:38:01 2018 +0000
+++ b/borgend.py	Sun Jan 21 22:43:57 2018 +0000
@@ -4,6 +4,7 @@
 import logging
 import logging.handlers
 import argparse
+import platform
 from fifolog import FIFOHandler
 
 #
@@ -87,7 +88,7 @@
             backups[i]=Backup(i, backupconfigs[i])
             backups[i].schedule()
 
-        if args.notray:
+        if args.notray or platform.system()!='Darwin':
             pass
         else:
             from ui import BorgendTray
--- a/config.py	Sun Jan 21 22:38:01 2018 +0000
+++ b/config.py	Sun Jan 21 22:43:57 2018 +0000
@@ -9,6 +9,7 @@
 import string
 import logging
 import borgend
+import platform
 from functools import reduce
 
 logger=borgend.logger.getChild(__name__)
@@ -41,7 +42,7 @@
 # Locations
 #
 
-if False:
+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")

mercurial