find_library

(function from pyomo.common.fileutils)

pyomo.common.fileutils.find_library(libname, cwd=True, include_PATH=True, pathlist=None)[source]

Find a dynamic library using find_file to search typical locations.

Finds a specified library (file) by searching a specified set of paths. This routine will look for the specified file name, as well as looking for the filename followed by architecture-specific extensions (e.g., .dll, .so, or .dynlib). Note that as this uses :py:func:find_file(), the filename and search paths may contain wildcards.

If the explicit path search fails to locate a library, then this returns the result from passing the basename (with ‘lib’ and extension removed) to ctypes.util.find_library()

Parameters:
  • libname (str) – The library name to search for

  • cwd (bool) – Start by looking in the current working directory [default: True]

  • include_PATH (bool) – Include the executable search PATH at the end of the list of directories to search. [default: True]

  • pathlist (str or list of str) – List of paths to search for the file. If None, then pathlist will default to the local Pyomo configuration library directory (and the local Pyomo binary directory if include_PATH is set) and the contents of LD_LIBRARY_PATH. If a string, then the string is split using os.pathsep. [default: None]

Notes

find_library() uses find_file() with allow_pathlist_deep_references=True, so libnames containing relative paths will be matched relative to all paths in pathlist.