Skip to content

Commit 8c9b5ef

Browse files
committed
dl: fix conflicts in get_libraries
Signed-off-by: Filipe Laíns <lains@riseup.net>
1 parent f51443d commit 8c9b5ef

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dynamic_library/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _get_module_path(name: str) -> list[str]:
3434
return module.__path__
3535

3636

37-
def _find_library(entrypoint: importlib_metadata.EntryPoint) -> str:
37+
def _find_library(entrypoint: importlib_metadata.EntryPoint) -> str | None:
3838
found = []
3939
for path in _get_module_path(entrypoint.value):
4040
lib = pathlib.Path(path, f'lib{entrypoint.name}{_EXT}')
@@ -46,12 +46,14 @@ def _find_library(entrypoint: importlib_metadata.EntryPoint) -> str:
4646
+ ', '.join(os.path(candidate) for candidate in found),
4747
stacklevel=2,
4848
)
49+
return
4950
if len(found) == 0:
5051
warnings.warn(f"Didn't find object file for library {entrypoint.name!r}", stacklevel=2)
52+
return
5153
return found[0]
5254

5355

5456
def get_libraries() -> Sequence[pathlib.Path]:
5557
entrypoints = importlib_metadata.entry_points(group='dynamic_library')
5658
sorted_entrypoints = sorted(entrypoints, key=operator.attrgetter('name'))
57-
return list(map(_find_library, sorted_entrypoints))
59+
return list(filter(None, map(_find_library, sorted_entrypoints)))

0 commit comments

Comments
 (0)