I've had a go at hacking up librpm's python bindings so that they work with both python 2 and python 3.
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.
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:
http://lists.rpm.org/pipermail/rpm-maint/2009-October/002528.html
Does anyone have a good test suite for the python rpm API?
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
/home/david/coding/python3/rpm-python-bi 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']))
b'im-chooser'-b'1.2.6'-b'3.fc11'
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:
http://lists.rpm.org/pipermail/rpm-maint/2009-October/002528.html
Does anyone have a good test suite for the python rpm API?
Leave a comment