Tools for inspecting RPM files in python. This module is modeled after the tarfile module.
import rpmfile with rpmfile.open('file.rpm') as rpm: # Inspect the RPM headers print(rpm.headers.keys()) print(rpm.headers.get('arch', 'noarch')) # Extract a fileobject from the archive fd = rpm.extractfile('./usr/bin/script') print(fd.read()) for member in rpm.getmembers(): print(member)
- rpmfile.RPMFile: The RPMFile object provides an interface to a RPM archive
- rpmfile.RPMInfo: An RPMInfo object represents one member in a RPMFile.