python-rpm:
https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch-rpm-programming-python.html
python-apt:
http://stackoverflow.com/questions/11727011/dpkg-python-module
http://apt.alioth.debian.org/python-apt-doc/
Actually, python-apt
allows you to work with these files directly. Here's an example:
from apt.debfile import DebPackage
from pprint import pprint
pkg = DebPackage('/tmp/wajig_2.7_all.deb')
pprint(pkg.filelist)
Output:
$ ./script.py
['./',
'etc/',
'etc/bash_completion.d/',
...
'usr/bin/',
'usr/bin/wajig']
It's not as complete as I would like sadly, but it has a bunch of functionality.