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
  - ...

With the optional demangle extra (pip install elfdeps[demangle]), --demangle demanges C++ symbol names:

$ elfdeps --symbols --demangle torchaudio-2.11.0-cp312-cp312-manylinux_2_28_x86_64.whl
...
exported_symbols:
  - torchaudio::cuda_version()
  - torchaudio::is_align_available()
  - ...

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.4.0.tar.gz (23.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.4.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: elfdeps-0.4.0.tar.gz
  • Upload date:
  • Size: 23.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.4.0.tar.gz
Algorithm Hash digest
SHA256 09655f500a8602e2776e016d069843cfd2ce1b8df1bf1a7b6ecb1c22d82577e5
MD5 9d3f40a742e530cd3c7f6cccaf12fee4
BLAKE2b-256 1827d429186f5d4fb5f9ce882e9de7dee0a4f33c58e45b90058dbc59d30cf63f

See more details on using hashes here.

Provenance

The following attestation bundles were made for elfdeps-0.4.0.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.4.0-py3-none-any.whl.

File metadata

  • Download URL: elfdeps-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 20.9 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 383b765a6bb7d4716328878ab0c79cfe06bac1cb5de3acbad9de12d6d71142b3
MD5 8c4c9121b384b43465edd5e159dba026
BLAKE2b-256 67b14b4348eaf6072c6f6c02cee003472a7ccb88c205a07f79ffc9b0e039cbe4

See more details on using hashes here.

Provenance

The following attestation bundles were made for elfdeps-0.4.0-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