Build Debian package for Python modules

kamal's picture

Just a note for future references. Tools to build Debian package for Python modules:-

Stdeb is not in Ubuntu Hardy repo so we need to build a package for itself first. Chicken and egg problem but just follow the instruction on the page, it works well.

# in the stdeb distribution directory (with setup.py)
python setup.py sdist
python setup.py build
PYTHONPATH="build/lib" python stdeb/py2dsc.py dist/stdeb-VERSION.tar.gz

I want to try hgsvn actually so let's build the package except that it failed complaining about setuptools-0.6c8. It want setuptools-0.6c9 but that's only under Intrepid. Can't find any backport or ppa. Searching around, this page explain how to build (backport) from Intrepid's source package.

$ vim /etc/apt/sources.list

Add this line to the end:
deb-src http://us.archive.ubuntu.com/ubuntu/ \
    hardy main restricted universe multiverse
Save and exit.

$ sudo apt-get update
$ sudo apt-get build-dep python-setuptools
$ fakeroot apt-get source -b python-setuptools
$ sudo dpkg -i python-setuptools_0.6c9-0ubuntu1_all.deb

It still complain about python-pkg-resources using the old version so just repeat the above step to build a package for python-pkg-resources. Now pulling up the svn repo into mercurial.