From d3bac93dad396a4173df5ee62a58f03fe4bb916b Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 3 Mar 2026 11:36:29 -0500 Subject: [PATCH 1/2] tests: add a nested pattern test Signed-off-by: Henry Schreiner --- tests/test_file_processor.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_file_processor.py b/tests/test_file_processor.py index 1de1423c..aaa39a7b 100644 --- a/tests/test_file_processor.py +++ b/tests/test_file_processor.py @@ -201,6 +201,30 @@ def test_include_patterns( assert result == expected +def test_include_pattern_with_nested_path_and_broad_exclude( + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, +) -> None: + """ + Test that nested include patterns are not pruned by directory traversal, + even when exclude patterns match all paths. + """ + monkeypatch.chdir(tmp_path) + nested_file = Path("a") / "b" / "c.txt" + nested_file.parent.mkdir(parents=True) + nested_file.write_text("content") + + result = set( + each_unignored_file( + Path(), + include=["a/b/c.txt"], + exclude=["*"], + mode="manual", + ) + ) + assert result == {nested_file} + + def test_exclude_patterns( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, From 8b9c5ea665577beff6dec9ed9d05fe781049191d Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 3 Mar 2026 11:56:07 -0500 Subject: [PATCH 2/2] fix: ensure posix style paths in prefix Signed-off-by: Henry Schreiner --- src/scikit_build_core/build/_file_processor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scikit_build_core/build/_file_processor.py b/src/scikit_build_core/build/_file_processor.py index f50e1408..a422daf8 100644 --- a/src/scikit_build_core/build/_file_processor.py +++ b/src/scikit_build_core/build/_file_processor.py @@ -89,7 +89,7 @@ def each_unignored_file( is_path=True, ): # Check to see if any include rules start with this - dstr = str(dirpath / dname).strip("/") + "/" + dstr = (dirpath / dname).as_posix().strip("/") + "/" if not any(p.lstrip("/").startswith(dstr) for p in include): dirs.remove(dname)