From f53a1dd9422981c8fd83aafa2523e89f9072002a Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Sat, 18 May 2024 16:57:02 -0300 Subject: [PATCH] bindings: Speed up library scanning Avoiding cmake cache, .gitlab-ci-local, windows injected paths drastically speeds up library scanning in slow filesystems --- bindings/python/ns__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bindings/python/ns__init__.py b/bindings/python/ns__init__.py index 64949af0e..c886650ab 100644 --- a/bindings/python/ns__init__.py +++ b/bindings/python/ns__init__.py @@ -82,12 +82,17 @@ def _search_libraries() -> dict: filter(lambda x: x not in SYSTEM_LIBRARY_DIRECTORIES, set(library_search_paths)) ) + # Exclude injected windows paths in case of WSL + # BTW, why Microsoft? Who had this brilliant idea? + library_search_paths = list(filter(lambda x: "/mnt/c/" not in x, library_search_paths)) + # Search for the core library in the search paths libraries = [] for search_path in library_search_paths: if os.path.exists(search_path): libraries += glob.glob( - "%s/**/*.%s*" % (search_path, LIBRARY_EXTENSION), recursive=False + "%s/**/*.%s*" % (search_path, LIBRARY_EXTENSION), + recursive=not os.path.exists(os.path.join(search_path, "ns3")), ) # Search system library directories (too slow for recursive search)