Lots of changes in structure to make it possible to package the program while
still allowing workflows to be placed in several locations in the file system. The installation procedure is now ./configure && make install configure will run m4 on fluents/paths.py.m4, Makefile.m4 and doc/Makefile.m4 so that the installation system and the program will know where some important directories are located. The paths.py.m4 and consequently also pahts.py files are just listings of directories configured during install. I did this to separate these from all other files so that as little as possible is touched by m4. It is still necessary to do an install now to get the program to run in a clean checkout. Workflows can now be placed anywhere in the system. This is done by setting the workflowdir variable in the configuration file. All workflow directories, separated by semicolons, are added to the python path. The use of setup.py is now deprecated.
This commit is contained in:
1762
fluents/cfgparse.py
Normal file
1762
fluents/cfgparse.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -19,9 +19,10 @@ from logger import logger, LogView
|
||||
|
||||
PROGRAM_NAME = 'fluents'
|
||||
VERSION = '0.1.0'
|
||||
DATADIR = os.path.dirname(sys.modules['fluents'].__file__)
|
||||
ICONDIR = os.path.join(DATADIR,"..","icons")
|
||||
GLADEFILENAME = os.path.join(DATADIR, 'fluents.glade')
|
||||
DATADIR = os.path.join(main.PYDIR, 'fluents')
|
||||
#ICONDIR = os.path.join(DATADIR,"..","icons")
|
||||
ICONDIR = main.ICONDIR
|
||||
GLADEFILENAME = os.path.join(main.PYDIR, 'fluents/fluents.glade')
|
||||
_icon_mapper = {dataset.Dataset: 'dataset',
|
||||
dataset.CategoryDataset: 'category_dataset',
|
||||
dataset.GraphDataset: 'graph_dataset',
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
|
||||
import sys
|
||||
import os.path
|
||||
import paths
|
||||
|
||||
# Site specific directories set by configure script.
|
||||
PREFIX = paths.PREFIX
|
||||
BINDIR = paths.BINDIR
|
||||
DATADIR = paths.DATADIR
|
||||
DOCDIR = paths.DOCDIR
|
||||
PYDIR = paths.PYDIR
|
||||
|
||||
ICONDIR = os.path.join(DATADIR, 'icons')
|
||||
|
||||
#: Dictionary of observers
|
||||
_observers = {}
|
||||
|
||||
7
fluents/paths.py.m4
Normal file
7
fluents/paths.py.m4
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
PREFIX = "M4_PREFIX"
|
||||
BINDIR = "M4_BINDIR"
|
||||
DATADIR = "M4_DATADIR"
|
||||
DOCDIR = "M4_DOCDIR"
|
||||
PYDIR = "M4_PYDIR"
|
||||
|
||||
@@ -6,12 +6,11 @@ import logger
|
||||
import fluents
|
||||
import main
|
||||
|
||||
def _workflow_classes(modname):
|
||||
def _workflow_classes(dir, modname):
|
||||
"""Returns a list of all subclasses of Workflow in a given module"""
|
||||
workflow_classes = []
|
||||
|
||||
__import__('workflows.%s' % modname)
|
||||
module = sys.modules['workflows.%s' % modname]
|
||||
module = __import__('%s' % (modname,))
|
||||
|
||||
d = module.__dict__
|
||||
for wf in d.values():
|
||||
@@ -58,7 +57,7 @@ def find_workflow(basename):
|
||||
fn = os.path.join(dir, "%s.py" % basename)
|
||||
if os.path.isfile(fn):
|
||||
wf_file = fn
|
||||
return _workflow_classes(basename)[0]
|
||||
return _workflow_classes(dir, basename)[0]
|
||||
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user