To package a python program for maemo, you just need to do in scratchbox the same as you would do on your desktop [using distutils and CDBS]. You add a simple setup.py file to the project, a minimal debian/rules, a couple of details in the debian/control file, run “dpkg-buildpackage”…. and it is done. Right?
No. it won’t work.
For some reason, inside scratchbox some paths are modified and the final .deb package install the files under “/scratchbox/tools/bin” and “/scratchbox/tools/share” (instead of the usual “/usr/bin” and “/usr/share”), so the package is somehow installable in scratchbox but useless for the real devices
I didn’t find any solution on the net, and It took me quite some time to figure out how to solve it. After a hundred tests with different CDBS rules and combinations, it was so easy as add a setup.cfg file on the root of my project with this content:
[install_scripts]
install_dir=debian/<package>/usr/bin[install_data]
install_dir=debian/<package>/usr/
After that, “dpkg-buildpackage -rfakeroot” generates a correct package, that can be uploaded to extras!
You get the /scratchbox path because scratchbox automatically runs its internal python instead of Maemo’s python.
Two ways I personally know around this:
Run python2.5 setup.py or instead of python setup.py or
in rules:
SBOX_REDIRECT_IGNORE := /usr/bin/python
export SBOX_REDIRECT_IGNORE
PATH := /usr/bin:$(PATH)
export PATH
But I didn’t know CDBS at all and thank you very much for sharing!
Thanks for your solution, faheem!
Another (CDBS specific) solution is to add this variable before the include lines in debian/rules:
cdbs_python_compile_version=2.5
This will force CDBS to always call python as “python2.5” and avoid the internal Python from scratchbox.