summaryrefslogtreecommitdiff
path: root/eo_py/README
blob: 96c78651a0a910a6ea63c92bab35d861cf3d53a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#########################################################################

EO Introspection - Python Bindings

#########################################################################

It analyzes XML files generated by EO introspection scanner and generates
python module.

#########################################################################

1. Generating python module for classes defined in XMLs:
    a. > python eo_py_gen.py --dir=XML_FOLDER --outdir=OUTDIR --pkg="lib1 lib2"
         --module=MODULE_NAME --xmldir=INCLUDE_XML_DIR -lname -I/include
      In case if some class is needed (usually parent class, which is not in the tree being analyzed),
      include XMLs are searched in python system paths.
      If include file wasn't found, explicit --include=INCLUDE_DIR dir is needed

      Files to be generated:
      - *.pxi files will be created for each *.xml
      - *.pxd will be created one for module.
      - MODULE_NAME.pyx (only one pyx allowed for compiling module)
        this file includes all *.pxi
      - setup.py
        setup.py can be edited in order to add include paths, libraries
        (which were not mentioned in --pkg option)
        compile options

      Addition:
         Sometimes, additional functions, which are not introspectable,
         must be included. User must implement and add them manually.
         (Cython knowledge is required)
    
         To do this user must provide definitions in *.pxd, *.pxi files,
         include *.pxi into generated 'module_name.pyx' file and compile.

   b. Compiling module:
      > python setup.py build_ext --inplace
      - module_name.so will be generated.

      Put module into python search path and import into your code.

########################################################################
########################################################################
########################################################################

2. Creating eobase module:
   a. Create new dir - PY_EOBASE    
      (DON'T NAME THIS dir "eobase", because
      this is module name)
   b. Base module folder being introspected - EOBASE
      > python eo_xml_gen.py --dir=EOBASE --outdir=PY_EOBASE
      - eobase.xml will be created in PY_EOBASE
   c. Creating eobase python sources:
      > python eo_py_gen.py  --dir=PY_EOBASE --outdir=PY_EOBASE --module=eobase
      --pkg="eo"
      To create base module, option --module must be "eobase"
      - eobase.pxd, eobase.pyx - will be created
      - eodefault.pxd, eodefault.pyx - will be copied into PY_EOBASE
      - setup.py will be created.
        setup.py can be modified in order to add include paths and libraries,
        which weren't mentioned in --pkg option
   d. Compiling python sources into python module.
      >  python setup.py build_ext --inplace
      - eodefault.so, eobase.so will be created
   e. Copy __init__.py to PY_EOBASE
      Add PYTHONPATH = PY_EOBASE