Py2deb configuration
Home Home Contact us Contact
home News Projects Tests Files Follow manatlan on Twitter Sign in
Last edition : 2009/09/05 08:18


Configuration of a package

from py2deb import Py2deb

Only the name of the package is mandatory. But all this attributes are available :

  • description : a textual description, by default "no description"
  • license : a debian license (gpl, lgpl, bsd or artistic), by default "gpl"
  • depends : a list of package/version according debian relationships, by default "" (empty)
  • section : a debian section (see debian sections), by default "utils"
  • arch : a debian architecture (see debian arch ), by default "all"
  • url : url where the package came from, by default ""
  • author : name of the author/packager, by default the env username
  • mail : mail of the author/packager, by default the env username @ hostname
  • preinstall : can be a script content or a file to act as pre-install script
  • postinstall : can be a script content or a file to act as post-install script
  • preremove : can be a script content or a file to act as pre-remove script
  • postremove : can be a script content or a file to act as post-install script

All this attributes can be available via the instance 'p', or can be passed as named arguments in the constructor.

Associate files in a package

Once the instance is created, you must associate files in the package, like that :


'p' acts like a dict, where the keys are the destination folder, and the values : a list of existing files (files! and not folders) in the execution path. Files can be defined as relative or absolute path, but it's not possible to define relative path which contains some ".." tricks. Each file can be renamed with the 'pipe trick', like that :


See more examples

Generation of a package

Simply call the generate() method which is defined like that :

def generate(self,version,changelog="no changelog",rpm=False,src=False)

Only the version is mandatory. But you can pass the changelog to be included in the package here. Put rpm at True if you want a rpm package too (which will simply use 'alien' to convert the deb to rpm). Put src at True if you want a "source package" (source package is a tar.gz "debian source package" which contains a 'debian folder', and can be used to recreate a deb from scratch)

Note that you can't generate a package if you hadn't files in !

Test of a package

At anytime you can see informations about your configuration by simply printing p like that :

print p

Which will display all configuration informations and all included files.

Note it's not a real test, it just try to display what it will try to generate. The generation process can fail if you miss config your files or your informations.


RSS Python Powered Get Ubuntu
©opyleft 2008-2019 - manatlan