Skip to content

Commit 764d0cf

Browse files
committed
Switch to rich binary wheels
1 parent 0c26e72 commit 764d0cf

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

findlibs/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
win32=".dll",
3131
)
3232

33+
binary_module_name = lambda s: f"{s}libs" # noqa: E731
34+
3335

3436
def _single_preload_deps(path: str) -> None:
3537
"""See _find_in_package"""
@@ -45,11 +47,12 @@ def _transitive_preload_deps(module: ModuleType) -> None:
4547
if hasattr(module, "findlibs_dependencies"):
4648
for module_name in module.findlibs_dependencies:
4749
try:
48-
rec_into = importlib.import_module(module_name)
49-
ext_path = str(Path(rec_into.__file__).parent)
50+
rec_into = importlib.import_module(binary_module_name(module_name))
5051
# NOTE we need *first* to evaluate recursive call, *then* preload,
5152
# to ensure that dependencies are already in place
5253
_transitive_preload_deps(rec_into)
54+
55+
ext_path = str(Path(rec_into.__file__).parent / "lib64")
5356
_single_preload_deps(ext_path)
5457
except ImportError:
5558
# NOTE we don't use ImportWarning here as thats off by default
@@ -72,10 +75,10 @@ def _find_in_package(
7275
It would be tempting to just extend LD_LIBRARY_PATH -- alas, that won't have any
7376
effect as the linker has been configured already by the time cpython is running"""
7477
try:
75-
module = importlib.import_module(pkg_name + "libs")
78+
module = importlib.import_module(binary_module_name(pkg_name))
7679
if preload_deps:
7780
_transitive_preload_deps(module)
78-
venv_wheel_lib = str((Path(module.__file__).parent / lib_name))
81+
venv_wheel_lib = str((Path(module.__file__).parent / "lib64" / lib_name))
7982
if os.path.exists(venv_wheel_lib):
8083
return venv_wheel_lib
8184
except ImportError:

tests/transitive/test_transitive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def libload_accumulator(path: str):
2626

2727
# test
2828
found = findlibs.find("modA")
29-
expected_found = str(Path(__file__).parent / "modAlibs" / "libmodA.so")
29+
expected_found = str(Path(__file__).parent / "modAlibs" / "lib64" / "libmodA.so")
3030
assert found == expected_found
3131

32-
expected_dylib = str(Path(__file__).parent / "modBlibs" / "libmodB.so")
32+
expected_dylib = str(Path(__file__).parent / "modBlibs" / "lib64" / "libmodB.so")
3333
assert loaded_libs == {expected_dylib}

0 commit comments

Comments
 (0)