From 934640ea624a742692780d218d078ac6a5ca91b4 Mon Sep 17 00:00:00 2001 From: einarr Date: Wed, 28 Feb 2007 14:07:33 +0000 Subject: [PATCH] Searches for /etc/fluentsrc and ~/.fluents configuration files. Adds the home configuration variable. --- bin/fluents | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/fluents b/bin/fluents index 6b21f3f..bccb995 100755 --- a/bin/fluents +++ b/bin/fluents @@ -1,6 +1,7 @@ #!/usr/bin/python2.4 from getopt import getopt +import os import sys from fluents import fluents, project, workflow import workflows @@ -20,7 +21,17 @@ def list_workflows(): print def parse_options(): + conf_files = ['/etc/fluentsrc', + os.path.join(os.environ['HOME'], '.fluents')] + cp = cfgparse.ConfigParser() + + cp.add_option('home', type='string', + default=os.environ['HOME']) + + cp.add_option('datadir', type='string', + default=os.environ['HOME']) + cp.parse() op = optparse.OptionParser() op.add_option('-l', '--list-workflows', @@ -32,6 +43,10 @@ def parse_options(): default='emptyview', help='Start with selected workflow') + for cf in conf_files: + if os.path.isfile(cf): + cp.add_file(cf) + return cp.parse(op) if __name__ == '__main__': @@ -54,6 +69,7 @@ if __name__ == '__main__': selected_wf = wf app = fluents.FluentApp(selected_wf) + app.options = options fluents.app = app app.set_project(project.Project())