Parsing .deb packages with Python?

Another ungoogleable question means it’s time to ask the Lazy Web again. Sometimes I wish that I could tell google what is the object and what is the subject.

Before I reinvent the wheel, does anybody know of a python module to unpack and parse debian packages, putting the information (such as the stuff in the control file) into a python object?

5 thoughts on “Parsing .deb packages with Python?

  1. Please install python-apt on a current debian/ubuntu system and have a look at /usr/share/doc/python-apt/examples/deb_inspect.py for example usage. I will be happy to help you (irc/mail) :)

  2. Package: python-apt
    Priority: optional
    Section: python
    Installed-Size: 116
    Maintainer: APT Development Team
    Architecture: all
    Version: 0.6.16.2ubuntu8
    Depends: python2.4-apt, python (= 2.4)
    Filename: pool/main/p/python-apt/python-apt_0.6.16.2ubuntu8_all.deb
    Size: 15374
    MD5sum: 0d721e6e58a5a08ed7f5f043ea6c6efb
    Description: Python interface to libapt-pkg
    The apt-pkg Python interface will provide full access to the internal
    libapt-pkg structures allowing Python programs to easily perform a
    variety of functions, such as:
    .
    – Access to the APT configuration system
    – Access to the APT package information database
    – Parsing of Debian package control files, and other files with a
    similar structure

    Bugs: mailto:ubuntu-users@lists.ubuntu.com
    Origin: Ubuntu
    Task: ubuntu-desktop, kubuntu-desktop, edubuntu-desktop, xubuntu-desktop

Leave a Reply

Your email address will not be published.