Skip to main content

Python implementation of RPM elfdeps

Project description

ELF deps

Python implementation of RPM elfdeps. The elfdeps tool can extract dependencies and provides from an ELF binary.

Example

$ elfdeps --requires /usr/bin/python3.12
libc.so.6(GLIBC_2.34)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libpython3.12.so.1.0()(64bit)
libc.so.6()(64bit)
rtld(GNU_HASH)

$ elfdeps --provides /usr/lib64/libpython3.12.so
libpython3.12.so.1.0()(64bit)
$ elfdeps --provides /lib64/libc.so.6
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.2.6)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
...
libc.so.6(GLIBC_2.36)(64bit)
libc.so.6(GLIBC_2.38)(64bit)
libc.so.6(GLIBC_ABI_DT_RELR)(64bit)
libc.so.6(GLIBC_PRIVATE)(64bit)
libc.so.6()(64bit)

elfdeps can also inspect archives like Python wheels and extract symbols:

$ elfdeps --symbols torchaudio-2.11.0-cp312-cp312-manylinux_2_28_x86_64.whl
filename: torchaudio/lib/_torchaudio.abi3.so
requires:
  - libgcc_s.so.1(GCC_3.0)(64bit)
  - libc.so.6(GLIBC_2.2.5)(64bit)
  - ...
provides: []
machine: EM_X86_64
is_dso: true
is_exec: true
got_debug: false
got_hash: false
got_gnuhash: true
soname: _torchaudio.abi3.so
exported_symbols:
  - _ZN10torchaudio12cuda_versionEv
  - _ZN10torchaudio18is_align_availableEv
  - ...
imported_symbols:
  - ...
  - aoti_torch_abi_version
  - aoti_torch_delete_library_object
  - ...

RPM

In Fedora-based distributions, RPM packages provide and require virtual packages with ELF sonames and versions. The package manager can install virtual provides.

The python3 base package depends on libpython3.12.so.1.0()(64bit) and libc.so.6(GLIBC_2.34)(64bit):

$ rpm -qR python3
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.34)(64bit)
libpython3.12.so.1.0()(64bit)
...
rtld(GNU_HASH)

The python3-libs package virtually provides libpython3.12.so.1.0()(64bit):

$ rpm -qP python3-libs
bundled(libb2) = 0.98.1
libpython3.12.so.1.0()(64bit)
libpython3.so()(64bit)
python-libs = 3.12.3-2.fc39
python3-libs = 3.12.3-2.fc39
python3-libs(x86-64) = 3.12.3-2.fc39
python3.12-libs = 3.12.3-2.fc39
$ sudo dnf install 'libc.so.6(GLIBC_2.34)(64bit)' 'libpython3.12.so.1.0()(64bit)'
Package glibc-2.38-18.fc39.x86_64 is already installed.
Package python3-libs-3.12.3-2.fc39.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

Public API

  • dataclass elfdeps.ELFAnalyzeSettings
  • exception elfdeps.ELFError
  • dataclass elfdeps.ELFInfo
  • dataclass elfdeps.SOInfo
  • elfdeps.analyze_dirtree(dirname, settings=None) -> Generator[ELFInfo, None, None]
  • elfdeps.analyze_elffile(elffile, *, filename, is_exec, settings=None) -> ELFInfo
  • elfdeps.analyze_file(filename, *, settings=None) -> ELFInfo
  • elfdeps.analyze_tarfile(tfile, *, settings=None) -> Generator[ELFInfo, None, None]
  • elfdeps.analyze_tarmember(tfile, tarinfo, *, settings=None) -> ELFInfo
  • elfdeps.analyze_zipfile(zfile, *, settings=None) -> Generator[ELFInfo, None, None]
  • elfdeps.analyze_zipmember(zfile, zipinfo, *, settings=None) -> ELFInfo

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

elfdeps-0.3.1.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elfdeps-0.3.1-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file elfdeps-0.3.1.tar.gz.

File metadata

  • Download URL: elfdeps-0.3.1.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for elfdeps-0.3.1.tar.gz
Algorithm Hash digest
SHA256 70ff06a802e60fb705150eed4f81ad717245634971185b421ba70e8cbb0b9028
MD5 6210dcea78a3ab069e6603f66a671fa9
BLAKE2b-256 5ef895a45066d38ed35cc75a4f85eb9d4775ddcf3446888c334aec0ddc6f2f36

See more details on using hashes here.

Provenance

The following attestation bundles were made for elfdeps-0.3.1.tar.gz:

Publisher: pypi.yaml on python-wheel-build/elfdeps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elfdeps-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: elfdeps-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for elfdeps-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 481850021acc639003e16874e68ae85101ea15d59cfd0777e02df2eaf5c8b1e8
MD5 379badc5a05daf8e96fee69d19d14d0c
BLAKE2b-256 d81b80afa3a7e4d1402b802f7175795d36f17e2da33bf056d8400247f550a30a

See more details on using hashes here.

Provenance

The following attestation bundles were made for elfdeps-0.3.1-py3-none-any.whl:

Publisher: pypi.yaml on python-wheel-build/elfdeps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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