Debianize python package

From Wikitech
Jump to navigation Jump to search

You really want to look at Git-buildpackage which has a section to build a debian package

Create an instance in labs.

sudo -s
gem install fpm
mkdir /mnt/workdir
cd /mnt/workdir

Official way

Using fpm

Pass to fpm the source type (-s python) and the target package system (-t deb) then the package name.

Quick example:

# fpm -s python -t deb  voluptuous
Created deb package {:path=>"/mnt/workdir/take2/python-voluptuous_0.6_all.deb"}
# ls *.deb

Long example:

fpm -s python -t deb \
  --maintainer "First Last <user@host.tld>" \
  --iteration wmf1 \
  --license BSD \
  --description 'Voluptuous, despite the name, is a Python data validation library. It is primarily intended for validating data coming into Python as JSON, YAML, etc.' voluptuous

You have now a very basic package.

Using is a wrapper around fpm that will take care of fetching any dependencies for you and build them as well.


Lookup your package at . We will use voluptuous as an example.

# cd /mnt/workdir
// download:
# wget
// uncompress
# tar -xvzf voluptuous-0.6.tar.gz
# cd /mnt/workdir/voluptuous-0.6
// build!
# ../ -m "Antoine Musso <>"

If all goes well, you will end up with some deb packages:

$ ls -1 *.deb