Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to package a software that contains both C++ and Python code. The C++ headers and libraries compile fine on launchpad and are properly installed (thanks to some .install files).

On the Python side of things, the names of the (raw) install files would be


What's the proper way to have them installed? Should I also create an .install file listing those files, or is there way to use dh_python2?

share|improve this question

Both. First you install them, then you call dh_python2.

dh_python will move things around, remove .pyc files, and handle byte-compilation at installation time.

share|improve this answer
What do you mean by "then"? Is a dedicated install target in debian/rules necessary that controls the installation and also calls dh_python2? – Nico Schlömer Jan 12 '13 at 18:35
dh_install is to put them in the right package. You need to make sure that dh_python2 gets called, but that usually wouldn't happen in an install target... – tumbleweed Jan 12 '13 at 19:19

The usual thing to do is to create a file and then call this from your rules file. With dh, your rules file, at least the python part, can then be as simple as

        dh $@ --with python2 --buildsystem=python_distutils --install-layout=deb
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.