On Fri, 04 Mar 2011 09:24:26 -0600, Daniel Mahoney wrote: > On Thu, 03 Mar 2011 22:24:24 -0500, Steven W. Orr wrote: > >> I look everywhere but I couldn't find anything. Could someone please >> point me to a small example program that does an import rpm, takes an >> rpm file as an argument and gets the list of files contained in the >> file, the same as if I had used the commandline >> >> rpm -pql foo-1.23-4.i586.rpm >> >> Much appreciated. >> >> TIA > > This is just a quick and dirty script, but how about: > > import os > import rpm > import sys > > ts = rpm.TransactionSet() > fd = os.open(sys.argv[1], os.O_RDONLY) h = ts.hdrFromFdno(fd) > os.close(fd) > > flist = h.fiFromHeader() > for file in flist: > print file[0] > > > > Dan
Oops - that didn't paste well. There is (obviously) supposed to be a newline after os.O_RDONLY) Dan -- http://mail.python.org/mailman/listinfo/python-list