Debianize python package

From Wikitech


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

http://wiki.debian.org/Python/Packaging


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
python-voluptuous_0.6_all.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 debianize.sh

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

git://github.com/specialunderwear/debianize.sh.git

Lookup your package at http://pypi.python.org/ . We will use voluptuous as an example.

# cd /mnt/workdir
// download:
# wget http://pypi.python.org/packages/source/v/voluptuous/voluptuous-0.6.tar.gz
// uncompress
# tar -xvzf voluptuous-0.6.tar.gz
# cd /mnt/workdir/voluptuous-0.6
// build!
# ../debianize.sh/debianize.sh -m "Antoine Musso <hashar@free.fr>"

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

$ ls -1 *.deb
python-distribute_0.6.34_all.deb
python-voluptuous_0.6_all.deb
$