summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/gras/GRAS_Factory.i35
-rw-r--r--python/gras/GRAS_Loader.py2
-rw-r--r--python/gras/__init__.py2
3 files changed, 17 insertions, 22 deletions
diff --git a/python/gras/GRAS_Factory.i b/python/gras/GRAS_Factory.i
index 1124963..eca9d2e 100644
--- a/python/gras/GRAS_Factory.i
+++ b/python/gras/GRAS_Factory.i
@@ -30,25 +30,18 @@ namespace gras
%pythoncode %{
#TODO we need to register this into the real factory
_py_factory = dict()
-%}
-%extend gras::Factory
-{
- %insert("python")
- %{
- @staticmethod
- def register_make(name, fcn):
- #TODO we need to register this into the real factory
- _py_factory[name] = fcn
-
- @staticmethod
- def make(name, *args, **kwargs):
-
- #first try the local to python py factory #TODO real factory
- if name in _py_factory: return _py_factory[name](*args, **kwargs)
-
- from PMC import PMC_M
- pmcargs = PMC_M(list(args))
- return Factory._handle_make(name, pmcargs)
- %}
-}
+def register_make(name, fcn):
+ #TODO we need to register this into the real factory
+ _py_factory[name] = fcn
+
+def make(name, *args, **kwargs):
+
+ #first try the local to python py factory #TODO real factory
+ if name in _py_factory: return _py_factory[name](*args, **kwargs)
+
+ from PMC import PMC_M
+ pmcargs = PMC_M(list(args))
+ return Factory._handle_make(name, pmcargs)
+
+%}
diff --git a/python/gras/GRAS_Loader.py b/python/gras/GRAS_Loader.py
index b70bc60..cc73d9b 100644
--- a/python/gras/GRAS_Loader.py
+++ b/python/gras/GRAS_Loader.py
@@ -2,6 +2,7 @@
import os
import sys
+import traceback
#try to import module
#http://effbot.org/zone/import-string.htm
@@ -15,6 +16,7 @@ def __try_module_import(filename):
module = __import__(module_name)
except Exception as ex:
print 'Could not import', filename, ex
+ print traceback.format_exc()
finally:
sys.path[:] = path # restore
diff --git a/python/gras/__init__.py b/python/gras/__init__.py
index 6dcd4cd..793eba8 100644
--- a/python/gras/__init__.py
+++ b/python/gras/__init__.py
@@ -10,7 +10,7 @@ from GRAS_SBuffer import SBufferConfig, SBuffer
from GRAS_Tags import Tag, StreamTag, PacketMsg
from GRAS_TimeTag import TimeTag
from GRAS_Element import Element
-from GRAS_Factory import Factory
+from GRAS_Factory import make, register_make
import GRAS_Block
import GRAS_HierBlock
import GRAS_TopBlock