* Changed build behaviour to suit newer Ubuntu releases (at least 9.10).

* Added -c option to generate intial configuration file and directories. This will create
  the file ~/.laydi and the directories ~/laydi/datasets and ~/laydi/workflows.
* Removed debug print statements.
main
Einar Ryeng 2010-01-19 16:45:51 +00:00
parent c50d34effc
commit 256133275c
5 changed files with 36 additions and 8 deletions

View File

@ -21,6 +21,29 @@ def list_workflows():
print ' %s (%s)' % (wf.ident, wf.name)
print
def generate_config():
fn = os.path.join(os.environ['HOME'], '.laydi')
if not os.path.exists(fn):
fd = open(fn, 'w')
print >> fd, "home = %s" % os.environ['HOME']
print >> fd, "datadir = %%(home)s/laydi/datasets"
print >> fd, "workflowdir = %%(home)s/laydi/workflows"
fd.close()
laydidir = os.path.join(os.environ['HOME'], 'laydi')
if not os.path.exists(laydidir):
os.mkdir(laydidir, 0755)
datadir = os.path.join(os.environ['HOME'], 'laydi/datasets')
if not os.path.exists(datadir):
os.mkdir(datadir, 0755)
workflowdir = os.path.join(os.environ['HOME'], 'laydi/workflows')
if not os.path.exists(workflowdir):
os.mkdir(workflowdir, 0755)
def parse_options():
conf_files = ['/etc/laydirc',
os.path.join(os.environ['HOME'], '.laydi')]
@ -43,9 +66,13 @@ def parse_options():
help='List available workflows.')
op.add_option('-w', '--workflow',
default='emptyview',
default='chemometric',
help='Start with selected workflow')
op.add_option('-c', '--generate-config',
action='store_true',
help='Generate configuration file ~/.laydi if it does not exist.')
for cf in conf_files:
if os.path.isfile(cf):
cp.add_file(cf)
@ -69,9 +96,11 @@ if __name__ == '__main__':
list_workflows()
sys.exit(0)
print "options.workflow:", options.workflow
if options.generate_config:
generate_config()
sys.exit(0)
selected_wf = workflow.find_workflow(options.workflow)
print selected_wf
if selected_wf == None: selected_wf = workflow.EmptyWorkflow
# workflow_list = workflow.workflow_list()
@ -86,7 +115,6 @@ if __name__ == '__main__':
main.set_application(app)
main.set_project(project.Project())
app.set_project(main.project)
app.show()
gtk.main()

2
configure vendored
View File

@ -22,7 +22,7 @@ done
if [[ $BINDIR == "" ]] ; then BINDIR=$PREFIX/bin ; fi
if [[ $DATADIR == "" ]] ; then DATADIR=$PREFIX/share/laydi ; fi
if [[ $DOCDIR == "" ]] ; then DOCDIR=$PREFIX/share/doc/laydi; fi
if [[ $PYDIR == "" ]] ; then PYDIR=$PREFIX/share/python-support/laydi; fi
if [[ $PYDIR == "" ]] ; then PYDIR=$PREFIX/share/pyshared/laydi; fi
m4 -D M4_PREFIX=$ROOT/$PREFIX -D M4_BINDIR=$ROOT/$BINDIR \
-D M4_DATADIR=$ROOT/$DATADIR -D M4_DOCDIR=$ROOT/$DOCDIR \

2
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: laydi
Section: science
Priority: optional
Maintainer: Einar Ryeng <einarr@pvv.org>
Build-Depends: debhelper (>= 5.0.37.2), python-dateutil, python-all-dev (>= 2.3.5-7), python-central (>= 0.5), python-numpy-dev (>= 1:1.0b5), python-epydoc, python-setuptools (>=0.6b3-1)
Build-Depends: debhelper (>= 5.0.37.2), python-dateutil, python-all-dev (>= 2.3.5-7), python-central (>= 0.5), python-epydoc, python-setuptools (>=0.6b3-1)
Standards-Version: 3.7.2
Package: laydi

2
debian/rules vendored
View File

@ -36,7 +36,7 @@ install-python%:
dh_testroot
dh_clean -k
dh_installdirs
./configure --root ${CURDIR}/debian/laydi/ --prefix /usr
./configure --root ${CURDIR}/debian/laydi --prefix /usr --pydir /usr/share/pyshared/
make install
# python$* setup.py install --root=$(CURDIR)/debian/laydi --install-data=/usr/share/laydi

View File

@ -50,7 +50,7 @@ def find_workflow(basename):
print "find_workflow"
# List all .py files that can contain workflow classes
wf_path = main.options.workflowdir.split(';')
wf_path = main.options.workflowdir.split(':')
wf_file = None
for dir in wf_path: