On Thu, Mar 3, 2011 at 7:24 PM, Steven W. Orr <[email protected]> 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.
#! /usr/bin/env python
import sys
import commands
if __name__ == "__main__":
rpm = sys.argv[1]
print commands.getoutput("rpm -pql %s" % rpm)
Input validation and help text left as an exercise for the reader.
Geremy Condra
--
http://mail.python.org/mailman/listinfo/python-list