A package 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_namestr - Library name without thelibprefix. The name of the library to find is formed usinglib_nameand a platform specific suffix (by default ".so"). E.g. whenlib_nameis "eccodes" the library name will be "libeccodes.so" on Linux and "libeccodes.dylib" on macOS.pkg_namestr, 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 to find the library in an installed python module package with the given name, e.g. eccodeslib, eckitlib. Disable this search option by setting environment variable
FINDLIBS_DISABLE_PACKAGE=yes. -
Next, tries the
libandlib64directories undersys.prefixand$CONDA_PREFIX. Disable this search option by setting environment variableFINDLIBS_DISABLE_PYTHON=yes. -
Next, tries the
libandlib64directories under the paths defined by thepkg_name + "_HOME"andpkg_name + "_DIR"environment variables. Both lowercase and uppercase versions are tested. E.g. ifpkg_nameis "eccodes" it will check the paths defined by$eccodes_dir,$eccodes_home,$ECCODES_DIRand$ECCODES_HOME. Disable this search option by setting environment variableFINDLIBS_DISABLE_HOME=yes. -
Next, tries to load the search paths from the user defined
~/.findlibsor~/.config/findlibs/findlibs.confINI configuration files. Then for all the user defined search paths, thelibandlib64subdirectories 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_directoryDisable this search option by setting environment variable
FINDLIBS_DISABLE_CONFIG_PATHS=yes. -
Next, tries the directories defined by the
$LD_LIBRARY_PATHand$DYLD_LIBRARY_PATHenvironment variables. Disable this search option by setting environment variableFINDLIBS_DISABLE_LD_PATH=yes. -
Next, tries the
libandlib64directories under the following paths "/", "/usr/", "/usr/local/", "/opt/", "/opt/homebrew/" and "~/.local/". Disable this search option by setting environment variableFINDLIBS_DISABLE_SYS=yes. -
Finally, tries calling the
ctypes.util.find_libraryfunction. Disable this search option by setting environment variableFINDLIBS_DISABLE_CTYPES_UTIL=yes.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file findlibs-0.1.2.tar.gz.
File metadata
- Download URL: findlibs-0.1.2.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f56d220c69686392ebdc4c65b32ee344818bca633643a8c97592957d1728122
|
|
| MD5 |
64d28aad0f9ff69f8ed17799e323035d
|
|
| BLAKE2b-256 |
22ef345b0f88b8e9d9e12051142a9cdcf590bf70206d20d81c3f773ade8d9e32
|
File details
Details for the file findlibs-0.1.2-py3-none-any.whl.
File metadata
- Download URL: findlibs-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5348bbc7055d2a505962576c2e285b6c0aae6d749f82ba71296e7d41336e66e8
|
|
| MD5 |
d6f45dad8bbcde9cc157cf19a6f42ffb
|
|
| BLAKE2b-256 |
2fff76dd547e129206899e4e26446c3ca7aeaff948c31b05250e9b8690e76883
|