I am building a .deb package of python module with dpkg-buildpackage.
in setup.py i have specified install_requires=['othermodule>=2.0']
but the generated control file does not specify version. Depends: python (>= 2.7), othermodule,
dh_python is guessing the requirements based on setup.py file. However the manpage of dh_python2 states that
(version requirements are ignored by default)
but I cannot manage to include the version in the control file. The problem is that without the version included the .deb package gets installed but then starting the program I get:
pkg_resources.DistributionNotFound: The 'othermodule>=2.0' distribution was not found and is required by ...
because the version installed is less than 2.0
I would like to be able to specify the dependency version only once (in the setup.py for example)
[EDIT:]
I see that in pydist.py the function load() searches in absolute paths:
def load(dname='/usr/share/python/dist/', fname='debian/pydist-overrides',
fbname='/usr/share/python/dist_fallback'):
instead of under ./debian where my package structure lays. And since the package is not installed yet (I am in the process of building it) the pydist file is not found. Am I missing something???
As stated in the Pybuild wiki:
dh_python2 and dh_python3 will correctly fill in the installation dependencies (via ${python:Depends} and ${python3:Depends} respectively)
So, if you will use ${python:Depends}
in your debian/control, dh_python will try to map your install_requires
from setup.py
to actual deb dependencies. Use it like this:
Depends: python (>= 2.7), ${misc:Depends}, ${python:Depends}
You can also specify the desired version for your othermodule
in debian/control just like you did for python:
Depends: python (>= 2.7), othermodule (>=2.0)
[EDIT]
You can place a pydist-overrides
file under the debian folder that makes use of PEP386
to force dh_python to include version information when resolving install dependencies. It uses the same syntax as a .pydist file:
OthermoduleName python-othermodule; PEP386
Hope this helps.