From e8136364adf237f9050b7c150c230abd38fff0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Fri, 19 Sep 2014 08:49:38 +0200 Subject: Initial import of mwc version 1.7.2-1 --- debian/patches/001-config.diff | 115 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 debian/patches/001-config.diff (limited to 'debian/patches/001-config.diff') diff --git a/debian/patches/001-config.diff b/debian/patches/001-config.diff new file mode 100644 index 0000000..7ccca33 --- /dev/null +++ b/debian/patches/001-config.diff @@ -0,0 +1,115 @@ +Description: add loading config from every path + Add loading config from ervery path + Separation data / program +Author: Jörg Frings-Fürst +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 2014-09-18 14:47:28.315407312 +0200 ++++ trunk/mwc.py 2014-09-18 14:49:11.000000000 +0200 +@@ -305,7 +305,7 @@ + + if __name__ == "__main__": + +- configMod = 'config' ++ configMod = '/etc/mwc/mwc-config' + dryrun = None + + try: +@@ -321,9 +321,24 @@ + 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 2014-09-18 14:47:28.315407312 +0200 ++++ trunk/config_template.py 2014-09-18 14:47:28.271406411 +0200 +@@ -1,5 +1,3 @@ +-import os.path +- + # Copyright: (2013-2014) Michael Till Beck + # License: GPL-2.0+ + +@@ -44,11 +42,11 @@ + smtphost = 'mysmtpprovider.com' + useTLS = True + smtpport = 587 +-smtpusername = sender ++smtpusername = 'sender' + smtppwd = 'mypassword' + receiver = 'me2@mymail.com' + +-os.chdir('/var/cache/mwc') ++datadir'/var/cache/mwc' + + enableRSSFeed = True + rssfile = 'feed.xml' +Index: trunk/mwcfeedserver.py +=================================================================== +--- trunk.orig/mwcfeedserver.py 2014-09-18 14:47:28.315407312 +0200 ++++ trunk/mwcfeedserver.py 2014-09-18 14:49:24.125775123 +0200 +@@ -6,6 +6,7 @@ + import http.server + import socketserver + import importlib ++import os + import sys + import getopt + +@@ -31,13 +32,26 @@ + elif opt in ('-p', '--port'): + port = int(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) + + handler = http.server.SimpleHTTPRequestHandler + + httpd = socketserver.TCPServer((bind, port), handler) + + print('Bond to ' + bind + ', listening on port ' + str(port)) +-httpd.serve_forever() +- ++try: ++ httpd.serve_forever() ++except KeyboardInterrupt: ++ pass ++httpd.server_close() -- cgit v1.2.3