Python Code Generation

Since FESA3 2.x a part of the code generation is done with Python instead of XSLT. One of the goals of this change is to be able to debug the code generation and to have more possibilities than with the functional programming language XSLT.

Setup

Project Location Softlink to  
fesa-codegen src/libs springpython -> /usr/lib/python2.6/site-packages/springpython/  
fesa-codegen Makefile.dep LIB_SPINGPYTHON_HOME = /usr/lib/python2.6/site-packages/springpython/  
fesa-codegen-gsi src/libs springpython -> /usr/lib/python2.6/site-packages/springpython/  
fesa-codegen-gsi src/py/ codegen -> ../../../fesa-codegen/src/py/codegen  
       

Eclipse:

  • before launching Eclipse set the PYTHONPATH environment variable, e.g. export PYTHONPATH=/home/bel/matthies/lnx/workspaceFesaFWK2.0.1/fesa-codegen/src/py/:/home/bel/matthies/lnx/workspaceFesaFWK2.0.1/fesa-codegen-gsi/src/py/ . If PyDev is installed a dialog will appear during the launch of Eclipse to confirm the content of PYTHONPATH.
  • install PyDev from update site http://update-production-pydev.s3.amazonaws.com/pydev/updates
  • set libs, src, test as source folders (right click in Project Explorer, PyDev > Set As Source Folder)

Usage

  • Edit Run Configurations, configure Python Runs or Python unittest
  • right click in Project Explorer, run as > Python

Debugging specific FESA design files

To debug a specific Python controller similar to the Eclipse plug-in call:
  • Create a new run configuration:
    • Project: fesa-codegen-gsi
    • Main module: ${workspace_loc:fesa-codegen-gsi/src/py/Generate.py}
    • Program arguments: $sourceFilePath $outputDirPath $controllerName(s), e.g. --overwrite /common/home/bel/matthies/lnx/runtime-EclipseApplicationLuna/UEye/src/UEye.design /common/home/bel/matthies/lnx/runtime-EclipseApplicationLuna/UEye/generated/cpp/UEye/GeneratedCode PropertyData
    • Working directory: set to ${workspace_loc:fesa-codegen-gsi/src/py}
  • Create a new run configuration automatically by right-clicking on a Python test and adapt the working directory manually.

-- SolveighMatthies - 17 Nov 2014
Topic revision: r5 - 22 May 2018, SolveighMatthies
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback