Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Searches for /etc/fluentsrc and ~/.fluents configuration files. Adds the

home configuration variable.
This commit is contained in:
Einar Ryeng 2007-02-28 14:07:33 +00:00
parent 281337251d
commit 934640ea62
1 changed files with 16 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/python2.4 #!/usr/bin/python2.4
from getopt import getopt from getopt import getopt
import os
import sys import sys
from fluents import fluents, project, workflow from fluents import fluents, project, workflow
import workflows import workflows
@ -20,7 +21,17 @@ def list_workflows():
print print
def parse_options(): def parse_options():
conf_files = ['/etc/fluentsrc',
os.path.join(os.environ['HOME'], '.fluents')]
cp = cfgparse.ConfigParser() 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 = optparse.OptionParser()
op.add_option('-l', '--list-workflows', op.add_option('-l', '--list-workflows',
@ -32,6 +43,10 @@ def parse_options():
default='emptyview', default='emptyview',
help='Start with selected workflow') help='Start with selected workflow')
for cf in conf_files:
if os.path.isfile(cf):
cp.add_file(cf)
return cp.parse(op) return cp.parse(op)
if __name__ == '__main__': if __name__ == '__main__':
@ -54,6 +69,7 @@ if __name__ == '__main__':
selected_wf = wf selected_wf = wf
app = fluents.FluentApp(selected_wf) app = fluents.FluentApp(selected_wf)
app.options = options
fluents.app = app fluents.app = app
app.set_project(project.Project()) app.set_project(project.Project())