Skip to main content

A packages to search for shared libraries on various platforms

Project description

findlibs

A Python package that searches for shared libraries on various platforms.

Usage

import findlibs
lib = findlibs.find("eccodes")

# If package name differs from library name use:
lib = findlibs.find(lib_name="odccore", pkg_name="odc")

Installation

pip install findlibs

Testing

git clone https://github.com/ecmwf/findlibs
cd findlibs
pip install -e ".[test]"
pytest

find

The module only contains the find() function.

def find(lib_name, pkg_name=None)

Returns the path to the selected library, or None if not found.

Arguments:

  • lib_name str - Library name without the lib prefix. The name of the library to find is formed using lib_name and a platform specific suffix (by default ".so"). E.g. when lib_name is "eccodes" the library name will be "libeccodes.so" on Linux and "libeccodes.dylib" on macOS.
  • pkg_name str, optional - Package name if it differs from the library name.

Returns:

str or None: Path to selected library

The algorithm to find the library is as follows:

  • First, tries the lib and lib64 directories under sys.prefix and $CONDA_PREFIX

  • Next, tries the lib and lib64 directories under the paths defined by the pkg_name + "_HOME" and pkg_name + "_DIR" environment variables. Both lowercase and uppercase versions are tested. E.g. if pkg_name is "eccodes" it will check the paths defined by $eccodes_dir, $eccodes_home, $ECCODES_DIR and $ECCODES_HOME.

  • Next, tries to load the search paths from the user defined ~/.findlibs or ~/.config/findlibs/findlibs.conf INI configuration files. Then for all the user defined search paths the lib and lib64 directories are tried.

    Please note that only one of these files can exist. The configuration file can contain multiple search paths, but no relative paths or paths to files are allowed. The file can even be completely empty or can contain no paths at all. The file format is as follows:

    [Paths]
    /path/to/lib_directory
    
  • Next, tries the directories defined by the $LD_LIBRARY_PATH and $DYLD_LIBRARY_PATH environment variables

  • Finally, tries the lib and lib64 directories under the following paths "/", "/usr/", "/usr/local/", "/opt/", "/opt/homebrew/" and "~/.local/"

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

findlibs-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

findlibs-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file findlibs-0.1.0.tar.gz.

File metadata

  • Download URL: findlibs-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for findlibs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d458b844c7044a75f68d909a0f6ca5a598fdec895a0e009a7f6cde0905de659
MD5 86627cd4965693ef30109e5c0a1a83a2
BLAKE2b-256 39d3fd6c52cb376a41cbacc4c46d88b025ddc56e2e59ee2d77af58b9f773f5dc

See more details on using hashes here.

File details

Details for the file findlibs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: findlibs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for findlibs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e5aeeaa33e972da79f54d120d0e4b0eb5d7384016b618a9b7da2ada2deb2248
MD5 ed421d1db9272401e2defe69500d2485
BLAKE2b-256 2878102e2cef3164ac047385231e7dc4a673aa8bc27c48df6ad397d7571d5e7c

See more details on using hashes here.

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