[Extras-cauldron-commits] r39 - trunk/buildme/buildlib
ed_ at garage.maemo.org
ed_ at garage.maemo.org
Sun May 18 22:07:49 EEST 2008
Author: ed_
Date: 2008-05-18 22:07:49 +0300 (Sun, 18 May 2008)
New Revision: 39
Modified:
trunk/buildme/buildlib/app.py
Log:
app: use alternative config file
Modified: trunk/buildme/buildlib/app.py
===================================================================
--- trunk/buildme/buildlib/app.py 2008-05-18 19:07:00 UTC (rev 38)
+++ trunk/buildme/buildlib/app.py 2008-05-18 19:07:49 UTC (rev 39)
@@ -53,14 +53,10 @@
logger.addHandler(self.handler)
self.appname = os.path.splitext(os.path.basename(sys.argv[0]))[0]
-
- self.conf = None
+
+ self.conf = ConfigParser()
self.confname = os.path.join('/etc', self.appname) + '.conf'
- if os.path.exists(self.confname):
- self.conf = ConfigParser()
- self.conf.read(self.confname)
-
def run(self, argv, cmdline_parser, mainfunc):
""" Run main function. Catch exceptions """
@@ -76,6 +72,12 @@
self.handler.setLevel(loglevel)
+ # use alternative config if provided
+ config = options.config
+ if config and os.path.exists(config):
+ self.confname = config
+ self.conf.read(self.confname)
+
mainfunc(argv, options, self._logger, self.conf)
# known exceptions
More information about the Extras-cauldron-commits
mailing list