From 256133275ccb6f4fb9cb47378f5e5cbf2cb65a13 Mon Sep 17 00:00:00 2001 From: einarr Date: Tue, 19 Jan 2010 16:45:51 +0000 Subject: [PATCH] * 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. --- bin/laydi | 36 ++++++++++++++++++++++++++++++++---- configure | 2 +- debian/control | 2 +- debian/rules | 2 +- laydi/workflow.py | 2 +- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/bin/laydi b/bin/laydi index ee35c7b..64dbc1a 100755 --- a/bin/laydi +++ b/bin/laydi @@ -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() diff --git a/configure b/configure index 9bedebf..889f787 100755 --- a/configure +++ b/configure @@ -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 \ diff --git a/debian/control b/debian/control index 7269bf5..ccd016e 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: laydi Section: science Priority: optional Maintainer: Einar Ryeng -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 diff --git a/debian/rules b/debian/rules index 4be0166..234a40d 100755 --- a/debian/rules +++ b/debian/rules @@ -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 diff --git a/laydi/workflow.py b/laydi/workflow.py index 374b731..57f5063 100644 --- a/laydi/workflow.py +++ b/laydi/workflow.py @@ -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: