Skip to main content

Read rpm archive files

Project description

rpmfile

Build Status Actions Status PyPI version

Tools for inspecting RPM files in python. This module is modeled after the tarfile module.

Install

$ python -m pip install -U rpmfile

If you want to use rpmfile with zstd compressed rpms, you'll need to install the zstandard module.

zstd also requires that you are using Python >= 3.5

$ python -m pip install -U zstandard

Example

See the tests for more examples.

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)

Command line usage

You can use rpmfile via it's module invocation or via rpmfile command if your PATH environment variable is configured correctly. Pass --help for all options.

List RPM contents

curl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | python -m rpmfile -l -
./path/to/file

Extract files

curl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | rpmfile -xv -
./path/to/file

Extract files to directory

curl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | rpmfile -xvC /tmp -
/tmp/path/to/file

Classes

  • rpmfile.RPMFile: The RPMFile object provides an interface to a RPM archive
  • rpmfile.RPMInfo: An RPMInfo object represents one member in a RPMFile.

Contributing

The black formater should be used on all files before submitting a contribution. Version 19.10b0.

$ pip install black==19.10b0
$ black .

Code in this module was borrowed from:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rpmfile-1.0.8.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

rpmfile-1.0.8-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file rpmfile-1.0.8.tar.gz.

File metadata

  • Download URL: rpmfile-1.0.8.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.6

File hashes

Hashes for rpmfile-1.0.8.tar.gz
Algorithm Hash digest
SHA256 e56cfc10e1a7d953b1890d81652a89400c614f4cdd9909464aece434d93c3a3e
MD5 e8f6af1489e0ea22b6cd749eadae71a0
BLAKE2b-256 237927e50c988bfbfabb75d17bff6cf1ae351104c3446e5a592823ff2a155505

See more details on using hashes here.

File details

Details for the file rpmfile-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: rpmfile-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.6

File hashes

Hashes for rpmfile-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 440e9dcfdfae85375eec6509aed37b6b75b01340e309d2d3cec4b13812a177a7
MD5 75bd23f4f7017ab119bbc8ffe8bec2fd
BLAKE2b-256 61d4b8f3c3364198880c7aa79bfb148197661b87009c0397a6f56fd16d2b616c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page