RSS | technovelty home | page of ian | ianw@ieee.org
There is a bit of an art to getting CDBS to build packages with Python extensions made with autotools, so hopefully this will help someone. This might be appropriate where you have a library which ships with some Python modules you wish to package.
The basic idea is to re-build separate trees for the various Python versions you wish to support, and then install these separate builds to the same place before creating the final package.
XS line to the top of your
control file with the Python versions to support, such as
XS-Python-Version: >=2.3. Then get this into a
variable in your rules file with pyversions
PY_VERSIONS = $(shell pyversions --requested debian/control)
python-all-dev,
python-central (>= 0.5).
Package: python-package
Architecture: any
Section: python
Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}
Provides: ${python:Provides}
XB-Python-Version: ${python:Versions}
Description: Python bindings for blah
Description here
configure/python-packagename target which will get called
early in the package creation phase. In standard make we
can make this target depend on "stamp" files for each version of
python we need to support. For example
configure/python-packagename:: $(addprefix configure-stamp-, $(PY_VERSIONS))
configure/python-packagename:: configure-stamp-2.3 configure-stamp-2.4 configure-stamp-2.5
configure-stamp-% which will setup separate build
directories for the different Python versions.
configure-stamp-%:
mkdir build-$*
cd build-$* && PYTHON=`which $*` $(DEB_CONFIGURE_SCRIPT_ENV) \
$(DEB_CONFIGURE_SCRIPT) \
$(DEB_CONFIGURE_NORMAL_ARGS) \
--disable-maintainer-mode \
$(cdbs_configure_flags) \
$(DEB_CONFIGURE_EXTRA_FLAGS) \
$(DEB_CONFIGURE_USER_FLAGS)
touch $@
build-stamp-%:
make -C build-$*
touch $@
build/python-package:: $(addprefix build-stamp-, $(PY_VERSIONS))
/usr/lib/python2.*/site-packages/. Then it is a matter
of putting them in python-package.install to be copied.
install-stamp-%:
make -C build-$* install DESTDIR=$(CURDIR)/debian/tmp
touch $@
install/python-package:: $(addprefix install-stamp-, $(PY_VERSIONS))
dh_pycentral for your package on
binary-install. See the Python
Policy for details on what this will do, especially if you are
shipping Python files which need to be pre-compiled.
binary-install/python-package:: dh_pycentral
clean rule.
clean::
-rm -rf $(addprefix build-, $(PY_VERSIONS))
-rm -rf $(addprefix configure-stamp-, $(PY_VERSIONS))
-rm -rf $(addprefix build-stamp-, $(PY_VERSIONS))
-rm -rf $(addprefix install-stamp-, $(PY_VERSIONS))
Thanks to Sebastien Bacher, who I think came up with this scheme
originally for gnome-menus.
posted at: Fri, 11 May 2007 13:34 | in /linux/debian | permalink | add comment (0 others)

This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.