1
2
3
4
5
6
7 """ Utility for exporting symbols to GPI.
8 """
9
10
11
12 import Ganga.GPI
13
14 from gangadoc import adddoc
15
16 -def exportToGPI(name,object,doc_section,docstring=None):
17 '''
18 Make object available publicly as "name" in Ganga.GPI module. Add automatic documentation to gangadoc system.
19 "doc_section" specifies how the object should be documented.
20 If docstring is specified then use it to document the object (only use for "Objects" section). Otherwise use __doc__ (via pydoc utilities).
21 FIXME: if you try to export the object instance, you should import it with fully qualified path, e.g.
22 import X.Y.Z
23 X.Y.Z.object = object
24 exportToGPI("obj",X.Y.Z.object,"Objects")
25
26 It has been observed that doing exportToGPI("obj",object,"Objects") may not work. To be understood.
27 '''
28
29 setattr(Ganga.GPI,name,object)
30
31 adddoc(name,object,doc_section,docstring)
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48