(library_name: str, library_path: List[str])
Given the raw name of a library in `library_name`, tries to find a
    static library with this name in the given `library_path`. `library_path`
    is automatically extended with common library directories on Linux and Mac
    OS X.
Given the raw name of a library in `library_name`, tries to find a
    static library with this name in the given `library_path`. `library_path`
    is automatically extended with common library directories on Linux and Mac
    OS X.
Given the raw name of a library in library_name tries to find a static library with this name in the given library_path . library_path is automatically extended with common library directories on Linux and Mac OS X .
def find_static_library(library_name: str, library_path: List[str]) -> Optional[str]:
    """Given the raw name of a library in `library_name`, tries to find a
    static library with this name in the given `library_path`. `library_path`
    is automatically extended with common library directories on Linux and Mac
    OS X."""

    variants = ["lib{0}.a", "{0}.a", "{0}.lib", "lib{0}.lib"]
    if is_unix_like():
        extra_libdirs = [
            "/opt/homebrew/lib",  # for newer Homebrew installations on macOS
            "/usr/local/lib64",
            "/usr/local/lib",
            "/usr/lib/x86_64-linux-gnu",
            "/usr/lib64",
            "/usr/lib",
            "/lib64",
            "/lib",
        ]
    else:
        extra_libdirs = []

    for path in extra_libdirs:
        if path not in library_path and os.path.isdir(path):
            library_path.append(path)

    for path in library_path:
        for variant in variants:
            full_path = os.path.join(path, variant.format(library_name))
            if os.path.isfile(full_path):
                return full_path
def find_static_library ( library_name : str , library_path : List [ str ] ) -> Optional [ str ] : variants = [ "lib{0}.a" , "{0}.a" , "{0}.lib" , "lib{0}.lib" ] if is_unix_like ( ) : extra_libdirs = [ "/opt/homebrew/lib" , # for newer Homebrew installations on macOS "/usr/local/lib64" , "/usr/local/lib" , "/usr/lib/x86_64-linux-gnu" , "/usr/lib64" , "/usr/lib" , "/lib64" , "/lib" , ] else : extra_libdirs = [ ] for path in extra_libdirs : if path not in library_path and os . path . isdir ( path ) : library_path . append ( path ) for path in library_path : for variant in variants : full_path = os . path . join ( path , variant . format ( library_name ) ) if os . path . isfile ( full_path ) : return full_path