Here's my progress so far, trying out some sample rpm python code with py3k. Some things appear to be working, but I really need a unit test suite to do this properly, I think.
[david@brick rpm]$ PYTHONPATH=/home/david/coding/python3/rp
m-python-bindings/install-prefix/lib/pyt hon3.1/site-packages python3
Python 3.1.1 (r311:74480, Oct 1 2009, 12:20:21)
[GCC 4.4.1 20090725 (Red Hat 4.4.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpm
ndings/install-prefix/lib/python3.1/site-p ackages/rpm/__init__.py:9: DeprecationWarning: Type rpm.hdr defines tp_reserved (formerly tp_compare) but not tp_richcompare. Comparisons may not behave as intended.
from rpm._rpm import *
# (clearly I need to fix this)
>>> rpm.addMacro("_dbpath", "/var/lib/rpm")
>>> ts = rpm.TransactionSet()
>>> mi = ts.dbMatch()
>>> for h in mi:
... print("%s-%s-%s" % (h['name'], h['version'], h['release']))
etc. (note how print has become a function, and how the data is coming back as "bytes", not as strings)
For the gory details, I sent my patches here:
Does anyone have a good test suite for the python rpm API?