diff --git a/src/scikit_build_core/build/_editable.py b/src/scikit_build_core/build/_editable.py index 9a1cca1b..f92d203f 100644 --- a/src/scikit_build_core/build/_editable.py +++ b/src/scikit_build_core/build/_editable.py @@ -70,6 +70,7 @@ def libdir_to_installed(libdir: Path) -> dict[str, str]: Convert a mapping of files to modules to a mapping of modules to installed files. """ return { - path_to_module(v.relative_to(libdir)): str(v.relative_to(libdir)) + path_to_module(pth): str(pth) for v in scantree(libdir) + if is_valid_module(pth := v.relative_to(libdir)) } diff --git a/src/scikit_build_core/build/_pathutil.py b/src/scikit_build_core/build/_pathutil.py index 9242290a..3bf020e3 100644 --- a/src/scikit_build_core/build/_pathutil.py +++ b/src/scikit_build_core/build/_pathutil.py @@ -28,7 +28,9 @@ def scantree(path: Path) -> Generator[Path, None, None]: def path_to_module(path: Path) -> str: - path = path.with_name(path.name.split(".", 1)[0]) + name, _, _ = path.name.partition(".") + assert name, f"Empty name should be filtered by is_valid_module first, got {path}" + path = path.with_name(name) if path.name == "__init__": path = path.parent return ".".join(path.parts) diff --git a/tests/packages/navigate_editable/CMakeLists.txt b/tests/packages/navigate_editable/CMakeLists.txt index 2c7f3e2e..13420b6f 100644 --- a/tests/packages/navigate_editable/CMakeLists.txt +++ b/tests/packages/navigate_editable/CMakeLists.txt @@ -12,6 +12,7 @@ python_add_library(c_module MODULE src/shared_pkg/c_module.c WITH_SOABI) set(CMakeVar "Some_value_C") configure_file(src/shared_pkg/data/generated.txt.in shared_pkg/data/c_generated.txt) +configure_file(src/shared_pkg/data/generated.txt.in shared_pkg/data/.hidden) install( TARGETS c_module @@ -19,3 +20,5 @@ install( COMPONENT PythonModule) install(FILES ${PROJECT_BINARY_DIR}/shared_pkg/data/c_generated.txt DESTINATION shared_pkg/data/) +install(FILES ${PROJECT_BINARY_DIR}/shared_pkg/data/.hidden + DESTINATION shared_pkg/data/)