python.rst 1.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
Python bindings for Ocarina
===========================

Ocarina Python bindings
#######################

Ocarina proposes Python bindings to its internal APIs. This binding is
available if configured properly, first at compile-time, then at
run-time.

yoogx's avatar
yoogx committed
11 12
At compile time, Ocarina must be configured with shared libraries
support. Refer to the :ref:`installation`;
13

yoogx's avatar
yoogx committed
14 15 16
At run-time, the following environment variables must be set up::

  % export PATH=`ocarina-config --prefix`/bin:$PATH
17 18 19 20 21 22 23
  % export OCARINA_PATH=`ocarina-config --prefix`
  % export LD_LIBRARY_PATH=$OCARINA_PATH/lib:$LD_LIBRARY_PATH
  % export PYTHONPATH=$OCARINA_PATH/include/ocarina/runtime/python:$OCARINA_PATH/lib:$PYTHONPATH

Example
#######

24 25
The following example illustrates the capabilities of the Python API,
it implements a visitor that iterates of the AADL model elements:
26

yoogx's avatar
yoogx committed
27 28
.. literalinclude:: ../resources/runtime/python/test/visitor.py
   :language: python
29 30 31 32 33 34

Python API description
######################

The following lists all functions defined in the `ocarina` module

35 36 37
.. automodule:: ocarina.ocarina
   :members:

38
.. automodule:: ocarina.lmp
39
   :members: