diff options
Diffstat (limited to 'debian/patches/0100-config.diff')
-rw-r--r-- | debian/patches/0100-config.diff | 81 |
1 files changed, 39 insertions, 42 deletions
diff --git a/debian/patches/0100-config.diff b/debian/patches/0100-config.diff index ce4dba7..8529874 100644 --- a/debian/patches/0100-config.diff +++ b/debian/patches/0100-config.diff @@ -5,47 +5,6 @@ Author: Jörg Frings-Fürst <jff@jff-webhosting.net> Last-Update: 2014-05-12 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/mwc.py -=================================================================== ---- trunk.orig/mwc.py -+++ trunk/mwc.py -@@ -319,7 +319,7 @@ def pollWebsites(): - - if __name__ == "__main__": - -- configMod = 'config' -+ configMod = '/etc/mwc/mwc-config' - dryrun = None - - try: -@@ -335,9 +335,24 @@ if __name__ == "__main__": - configMod = arg - elif opt in ('-d', '--dry-run'): - dryrun = arg -- -- config = importlib.import_module(configMod) -- -+ # -+ # add code to load config from nonsystem path -+ # and change to datadir -+ # -+ try: -+ path = os.path.dirname(configMod) -+ fullname = os.path.basename(configMod) -+ sys.path.append(path) -+ config = importlib.import_module(fullname) -+ except: -+ print('Error: loading config') -+ sys.exit(2) -+ try: -+ os.chdir(config.datadir) -+ except: -+ print('Error: datadir not found') -+ sys.exit(3) -+ - if dryrun: - for site in config.sites: - if site['shortname'] == dryrun: Index: trunk/config_template.py =================================================================== --- trunk.orig/config_template.py @@ -56,7 +15,7 @@ Index: trunk/config_template.py # Copyright: (2013-2014) Michael Till Beck <Debianguru@gmx.de> # License: GPL-2.0+ -@@ -46,11 +44,11 @@ sender = 'me@mymail.com' +@@ -47,11 +45,11 @@ sender = 'me@mymail.com' smtphost = 'mysmtpprovider.com' useTLS = True smtpport = 587 @@ -113,3 +72,41 @@ Index: trunk/mwcfeedserver.py +except KeyboardInterrupt: + pass +httpd.server_close() +Index: trunk/mwc.py +=================================================================== +--- trunk.orig/mwc.py ++++ trunk/mwc.py +@@ -334,7 +334,7 @@ def pollWebsites(): + + if __name__ == "__main__": + +- configMod = 'config' ++ configMod = '/etc/mwc/mwc-config' + dryrun = None + + try: +@@ -351,7 +351,23 @@ if __name__ == "__main__": + elif opt in ('-d', '--dry-run'): + dryrun = arg + +- config = importlib.import_module(configMod) ++ # ++ # add code to load config from nonsystem path ++ # and change to datadir ++ # ++ try: ++ path = os.path.dirname(configMod) ++ fullname = os.path.basename(configMod) ++ sys.path.append(path) ++ config = importlib.import_module(fullname) ++ except: ++ print('Error: loading config') ++ sys.exit(2) ++ try: ++ os.chdir(config.datadir) ++ except: ++ print('Error: datadir not found') ++ sys.exit(3) + + if dryrun: + for site in config.sites: |