Advice packaging a C++ lib and it's python bindings.

Shashank Chintalagiri shashank.chintalagiri at gmail.com
Mon Dec 2 11:54:57 UTC 2013


Hi,

I'm looking into trying to package a particular (home-brew) C++ library and
python bindings that we use to handle the interface to an instrument we've
developed. I would like some advice or pointers on how this should be
approached, both as a general case and if we would like to request
inclusion in Universe (though I understand it comes with a really rare and
specific use case, and we will probably have to use the separate repo / PPA
route)

The following are essentially the pieces which are in play, for background
:

Custom Hardware <-> Custom Firmware (avr-g++) <-USB-> Driver (C++, built on
top of libftdi) <-> Python Bindings generated by SWIG <-> Python GUI and
app etc.

Specifically, I would like to start by packaging the Driver (C++, using
libftdi, and running in userspace) and it's python bindings generated using
swig.

The present deployment scheme we use is a simple makefile, that compiles
the C++ into a .so and dumps all the necessary files into the python
dist-packages folder. Effectively, I end up with the following files in
/usr/local/lib/python-2.7/dist-packages :

libxlia-0.1.egg-info
libxlia.py
libxlia.pyc
_libxlia.so

While this scheme functionally works, it does have the following problems
which I am less certain about :
1. The Python dist-packages folder is contaminated with a C++ binary blob.
I don't know if this is accepted practice, but I would guess it isn't.
2. The dist-packages folder is also now littered with plenty of files (4
files instead of the usual single folder or egg file)

What I need help or advice with, therefore, is how such a scheme would
normally be packaged. Do I package the C++ lib and the bindings separately,
and in that case is there any reference available about where each of the
packages should install to? Also, if I do split them into separate
packages, how do I ensure that the two will be able to find each other (or
the python bindings be able to find the .so). Specifically, are there any
defined PATH variables I should know about in order to make the packages
install like any 'standard' .deb packages should install to?

Thanks and Regards
Shashank
-- 

Chintalagiri Shashank
Quazar Technologies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-motu/attachments/20131202/bbe3ef49/attachment.html>


More information about the Ubuntu-motu mailing list