Search code examples
pythondebianpackagingsetup.pydebhelper

Overriding or disabling ${python:Depends} at stdeb bdist_deb invocation


I am trying to package my Python software with stdeb:

python setup.py --command-packages=stdeb.command bdist_deb

which works fine.

Unfortunately, stdeb adds the variable ${python:Depends} to the debian/control file. This placeholder is automatically processed by dh_python2 from debhelper and gets replaced by a string containing multiple Python versions, e.g.: "python2.7, python (>= 2.7.1-0ubuntu2), python (<< 2.8)".

How can I get rid of these automatically added Python versions or how can I override ${python:Depends}?

Note: The actual problem is the python dependency. The target system provides the package python2.7 with version 2.7.3, but python is still at 2.6.6.


Solution

  • What you actually need to do instead is to add something like X-Python-Version: >= 2.6 to source package in debian/control and to add python-all or python-all-dev to Build-Depends. This will work if you're building for the right suite where python-all depends on both python2.6 and python2.7. It is a good idea to use pbuilder in order to build for target system especially if it is different from your development environment. Please do not override ${python:Depends} -- it is wrong and will do no good.