Skip to content

Commit

Permalink
Prevent static libraries from being suggested (#7)
Browse files Browse the repository at this point in the history
The "LIBRARY" config variable can be a static library. This is currently
handled by replacing the extension with the shared object extension for
the current OS. This makes an assumption about the possible name, so
instead we just filter out the name if it has a static object extension.

Additionally, the "LDLIBRARY" config variable should *always* return a
dynamic object (or nothing. Hence the "LD".), but some environments are
misconfigured.
  • Loading branch information
ktbarrett committed Feb 6, 2021
1 parent 45fd8cc commit 35496ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/find_libpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ def candidate_names(suffix=SHLIB_SUFFIX):
Candidate name libpython.
"""
LDLIBRARY = sysconfig.get_config_var("LDLIBRARY")
if LDLIBRARY:
if LDLIBRARY and os.path.splitext(LDLIBRARY)[1] == suffix:
yield LDLIBRARY

LIBRARY = sysconfig.get_config_var("LIBRARY")
if LIBRARY:
yield os.path.splitext(LIBRARY)[0] + suffix
if LIBRARY and os.path.splitext(LIBRARY)[1] == suffix:
yield LIBRARY

dlprefix = "" if is_windows else "lib"
sysdata = dict(
Expand Down

0 comments on commit 35496ba

Please sign in to comment.