[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

pybuild - one to rule^W build them all

[debhelper's #538978 and #597105 bugs BCCed]


FYI: python3 package in experimental (3.3.0-2) contains pybuild tool
with dh command sequencer integration.

You can build modules/extensions for Python 2.X *and* Python 3.X with
this debian/rules file:

 #!/usr/bin/make -f
 	dh $@ --with python2,python3 --buildsystem=pybuild

pybuild.pm will check Build-Depends* and build Python (python,
python-dev, python-dbg, python-all, python-all-dev, python-all-dbg),
Python 3 (python3, python3-dev, python3-dbg, python3-all,
python3-all-dev, python3-all-dbg) and PyPy (pypy) modules/extensions.

It can be configured via command line or CDBS-like - by exporting
PYBUILD_OPTION_interpreterversion env. variables in debian/rules, f.e.

* if you don't want to use debian/*.install files,
  you can set DESTDIR for each interpreter (note that you can use "python2" for
  all python2.X interpreters and "python3" for all python3.X ones):

 export PYBUILD_DESTDIR_python2=debian/python-foo/
 export PYBUILD_DESTDIR_python2-dbg=debian/python-foo-dbg/
 export PYBUILD_DESTDIR_python3=debian/python3-foo/
 export PYBUILD_DESTDIR_python3-dbg=debian/python3-foo-dbg/
 export PYBUILD_DESTDIR_python3.1-dbg=debian/spam-pkg-with-python3.1-only/
 export PYBUILD_DESTDIR_pypy=debian/pypy-foo/

* if you want to add some custom arguments to Python 3's install command:

 export PYBUILD_INSTALL_ARGS_python3=--install-scripts=/usr/share/foo/

* you can disable (almost) any action via --disable / DISABLE env. var:

 export PYBUILD_DISABLE=configure
 export PYBUILD_DISABLE_python3.1=test

* if you want to disable Build-Depends detection:

 export PYBUILD_INTERPRETERS=python{version} python{version}-dbg
 export PYBUILD_VERSIONS=2.7 3.3

* if auto detection didn't detect the right build system:

 export PYBUILD_SYSTEM=distutils

* if you want to add a custom command before or after each iteration:

 export PYBUILD_BEFORE_BUILD=echo {version} >> '{dir}/enabled'
 export PYBUILD_AFTER_INSTALL=rm -rf '{destdir}/{install_dir}/foo/tests'

Right now it supports distutils (i.e. setup.py) and custom build systems only
(I tried to add cmake one that uses dh_auto_* tools, but failed to teach cmake
which interpreter should be used).

Anyone wants to contribute more plugins? Let me know if you want some guidance
or if I can make writing plugins easier.

If your build system is not yet supported, you can use custom build system:

 export PYBUILD_SYSTEM=custom
 export PYBUILD_CLEAN_ARGS=rm -rf {build_dir}/python{version}/
 export PYBUILD_CONFIGURE_ARGS=./configure --python={version}
 export PYBUILD_BUILD_ARGS=make build --dir={build_dir} --python={version}
 export PYBUILD_INSTALL_ARGS=make --destdir={destdir} --python={version} --install-dir={install_dir}
 export PYBUILD_TEST_ARGS_python2=cd {build_dir}; nosetests
 export PYBUILD_TEST_ARGS_python3=cd {build_dir}; python{version} -m discover

PS pybuild manpage is available also here: http://deb.li/pybuild
Piotr Ożarowski                         Debian GNU/Linux Developer
www.ozarowski.pl          www.griffith.cc           www.debian.org
GPG Fingerprint: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645

Attachment: signature.asc
Description: Digital signature

Reply to: