On 3/3/2011 11:11 PM, geremy condra wrote:
On Thu, Mar 3, 2011 at 7:24 PM, Steven W. Orr<ste...@syslang.net>  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.

Thank you, but this is not what I was looking for. What I want is the same thing but uses the rpm module. After I get this piece of it working I'll be able to do the rest of what I want, but the important thing is that it happens in the context of import rpm.

Anyone?


#! /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


--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to