Py2deb
Home Home Contact us Contact
home News Projects Tests Files Follow manatlan on Twitter Sign in
Last edition : 2 years ago
related news

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)

  • easy, very easy (compared to all other way to do)
  • able to generate packages rpm and sources too

Known Limitation(s)

  • not able to sign packages
  • not able to distinguish authors and packagers (only one same guy now)

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.6 - 19/feb/12

    • now the package install py2deb for python2.6 and 2.7 only
  • Version 0.5 - 05/sept/09

    • now the package install py2deb in the right place for python2.6
    • py2deb accepts pre/post install/remove scripts
  • Version 0.4 - 14/sept/08

    • Should work on debian too (use USER or USERNAME env)
    • Install py2deb for python 2.4, 2.5 and 2.6
  • Version 0.3

    • Initial public release (GPL2 licence)
    • Install the module py2deb for python2.4 and python2.5 (sources included)
RSS Python Powered Get Ubuntu
©opyleft 2008 - manatlan cmd snippets