In this tutorial a python extension package called 'pypizza' is created which packages a shared library named libPizza.so which is written in the Xc++ language.
This tutorial assumes you have installed the CEDA SDK and installed the pyceda module.
It is assumed the CEDA SDK is located at ~/developer/ceda
Run the following commands in a bash terminal to download the pizza source code (as a tarball named pizza-0.7.tar.gz) from the cedanet website:
cd ~/developer
wget http://cedanet.com.au/ceda/xcpp/linux/pizza-0.7.tar.gz
Alternatively download the tarball using this link: pizza-0.7.tar.gz (file size is 4kB)
Run the following commands to uncompress pizza-0.7.tar.gz into ~/developer:
cd ~/developer
tar -xvf pizza-0.7.tar.gz
~ └── developer └── pizza └── Acme ├── build_local_android.xcpp ├── build_pizza_library ├── build_pizza_library_android ├── Pizza │ ├── DateTime.h │ ├── PizzaDeliveries.h │ ├── Pizza.h │ ├── Shapes.h │ └── src │ ├── Pizza.cpp │ └── Pizza.xcpj ├── pypizza_package │ ├── pypizza │ │ ├── __init__.py │ │ └── lib │ │ ├── linux │ │ ├── macOS │ │ └── windows │ └── setup.py ├── selectcompiler_android.xcpp ├── wsPizza.xcpp ├── wsPizza_android.xcpp └── wsPizza.xcws
cd ~/developer
pizza/Acme/build_pizza_library
After editing the models, it is a simple matter of running the build script again to rebuild the shared library libPizza.so and reinstall it as a python extension module.
In a python interpeter, import pypizza and pyceda and take dir(pyceda.cns) and check that pizza has been added.
user@host:~/developer$ python Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pypizza >>> import pyceda >>> dir(pyceda.cns) ['ENotificationLevel', 'FindChildNameSpace', 'FindElement', 'FindElementWithRelativePath', 'GetChildNameSpaceIterator', 'GetElementIterator', 'GetName', 'Int64', 'Notification', 'PyObject', 'UInt64', 'ceda', 'dt', 'pizza', 'shapes'] >>>
In this case the build artefacts folder is located at ~/developer/build_pizza_lib
~ └── developer └── build_pizza_lib ├── build ├── export ├── include ├── lib └── pypizza_package
To generate the pypizza distutils tarball run the commands:
cd ~/developer/build_pizza_lib/pypizza_package/
python setup.py sdist
This generates the following output:
running sdist running check warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list) warning: sdist: standard file not found: should have one of README, README.txt writing manifest file 'MANIFEST' creating pizza-0.7 creating pizza-0.7/pypizza creating pizza-0.7/pypizza/lib creating pizza-0.7/pypizza/lib/linux making hard links in pizza-0.7... hard linking setup.py -> pizza-0.7 hard linking pypizza/__init__.py -> pizza-0.7/pypizza hard linking pypizza/lib/linux/libPizza.so -> pizza-0.7/pypizza/lib/linux creating dist Creating tar archive removing 'pizza-0.7' (and everything under it)
and results in the following tree structure:
~ └── developer └── build_pizza_lib └── pypizza_package ├── dist │ └── pizza-0.7.tar.gz └── MANIFEST