py2deb

A python module to easily create a debian package deb (w/ rpm, w/ source package). There is a gtk frontend too : py2deb-gtk

Introduction

In fact, it's a lot based on this tutorial build a deb from py ! It's just an automated way to do this. So it could be possible to package everything (not only python files).

It depends on : dpkg-dev, fakeroot, alien and python.

Feature(s)

Known Limitation(s)

Documentation

The simplest way to do, is to create a python file, at the root of your application, and code something like that :

from py2deb import Py2deb

p=Py2deb("aeff")
p["/usr/lib/python2.5/site-packages"] = ["mymodule.py",]
p.generate("0.1")

When this script will be executed : it will generate the deb file aeff_0.1_all.deb, in the current folder. When you will install the deb, it will install the file mymodule.py in the site-packages of python2.5 !

Another simple example (use of the 'pipe trick'):

p=Py2deb("myprogram")
p["/usr/bin"] = ["myprogram.py|myprogram",]
p.generate("0.2")

will generate a myprogram_0.2_all.deb which will install the file myprogram.py as /usr/bin/myprogram.(the file myprogram.py is renamed as myprogram before copying)

see more examples

But sure, it's possible to configure a lot of things. Here is a most complex example, which is used to build packages for fricorder :

from glob import glob

version="0.7.33"
changelog=open("changelog.txt","r").read()

p=Py2deb("fricorder")
p.author="manatlan"
p.mail="manatlan@gmail.com"
p.description="""Programme permettant l'enregistrement différé de
flux freebox dans le cadre du multiposte de free."""
p.url = "http://fricorder.googlecode.com"
p.depends="bash, at, zenity, vlc, python-gtk2, python-glade2, python"
p.license="gpl"
p.section="utils"
p.arch="all"

p["/usr/share/applications"]=["data/fricorder.desktop|fricorder.desktop"]
p["/usr/share/fricorder"]=[i+"|"+i[5:] for i in \
                         glob("data/*.*") + glob("data/templates/*")]
p["/usr/lib/fricorder"]=glob("fricorder/*")+["__init__.py"]
p["/usr/bin"]=["fricorder.py|fricorder"]
p["/usr/share/doc/fricorder"]=["README","COPYING",]

p.generate(version,changelog,rpm=True,src=True)

which create a deb package, a rpm package (aliened), and a source package.

see more configuration

Download

Version 0.3 - Initial public release (GPL2 licence)

Install the module py2deb for python2.4 and python2.5 (sources included)

log in

manatlan