[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

ANNOUNCE: python-apt

  (crossing my fingers and hoping I'm posting to the right list for this)

  Hello, all.  I've started working on Python bindings for the APT libraries.
I've gotten enough done to have a somewhat useful preliminary version which
can open the package cache and retrieve some information about packages;
dependencies, provides, file lists, downloading, package records, and the
Acquire system are all yet to be wrapped.  What I have so far seems to work
fairly well, though (although it probably needs to be split into multiple files,
for neatness, and needs a real Makefile) -- it doesn't have an 'install' target
in the Makefile yet, though, so you'll have to either do this yourself or
run all your scripts from the python-apt source directory :)

  python-apt was started partly to look at the possibility of someday allowing
Python to be embedded into aptitude, and so the python-apt source is currently
available from the aptitude Web site:

  It's probably not the best place for this, and when I find a good place (maybe
a separate Sourceforge project..) I'll probably move it.

  A quick example of python-apt:
bluegreen:~/python-apt> python
Python 1.5.2 (#0, Sep 13 1999, 09:12:57)  [GCC 2.95.1 19990816 (release)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import apt
>>> file=apt.CacheFile(apt.OpTextProgress(), 0)
Reading Package Lists... Done
Building Dependency Tree... Done
>>> print file['foo']
>>> print file['dpkg']
<APT package iterator: dpkg>
>>> print file['dpkg'].currentver
<APT package iterator: dpkg 1.6.8>
>>> print file['dpkg'].currentver.section
>>> print file['aptitude'].versionlist
<APT package iterator: aptitude 0.0.6a-2>
>>> print file['aptitude'].versionlist.next
<APT package iterator: aptitude 0.0.4a-4>
>>> print file['aptitude'].versionlist.next.next
<APT package iterator: END>


Reply to: