Building a Ubuntu DEB package for a Python module

by Amit


Here are some links, and some #ubuntu-motu logs that can help you create a DEB package for a pure-Python module and also upload it to your PPA.

The definitive starting point is https://wiki.ubuntu.com/PackagingGuide/Python. This guide is pretty much almost all what you need if you are looking to create a DEB package for a Python application or a Python module. Please follow the instructions given there carefully.

The above guide doesn’t tell you the things that you also need to do if you are looking to upload your package to your own PPA on launchpad, like signing the package, creating only source packages, writing a good copyright file, etc. So, I turned to the amazing folks in #ubuntu-motu

  • Use debuild -sa -S to build source packages which are also signed with your GPG key. You WILL need to have signed packages before you can upload it to your PPA. The advantage of using ‘debuild’ over directly using ‘dpkg-buildpackage‘ is that it also uses lintian to check your package for possible policy violations.
  • A good way to write the debian/copyright file is here at http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
  • Before uploading it to the PPA, you should check if your package has been properly constructed by setting up a pbuilder environment

That’s it. You should now upload the source package to the PPA using the instructions given.

Advertisements