Skip to content

Commit 983068d

Browse files
authored
fix: add logging for file inclusion (#1110)
1 parent f5c72a2 commit 983068d

File tree

3 files changed

+417
-1
lines changed

3 files changed

+417
-1
lines changed

docs/about/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Fixes:
99

1010
- Improve `.gitignore` iteration speed by @silversquirl in #1103
1111
- Warn on 3.13.4 on Windows by @henryiii in #1104
12+
- Add debug logging explaining why a file is included/excluded by @henryiii in
13+
#1110
1214

1315
Documentation:
1416

src/scikit_build_core/build/_file_processor.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
import pathspec
99

10-
from scikit_build_core.format import pyproject_format
10+
from .._logging import logger
11+
from ..format import pyproject_format
1112

1213
if TYPE_CHECKING:
1314
from collections.abc import Generator, Sequence
@@ -72,19 +73,31 @@ def each_unignored_file(
7273
for p in all_paths:
7374
# Always include something included
7475
if include_spec.match_file(p):
76+
logger.debug("Including {} because it is explicitly included.", p)
7577
yield p
7678
continue
7779

7880
# Always exclude something excluded
7981
if user_exclude_spec.match_file(p):
82+
logger.debug(
83+
"Excluding {} because it is explicitly excluded by the user.", p
84+
)
8085
continue
8186

8287
# Ignore from global ignore
8388
if global_exclude_spec.match_file(p):
89+
logger.debug(
90+
"Excluding {} because it is explicitly excluded by the global ignore.",
91+
p,
92+
)
8493
continue
8594

8695
# Ignore built-in patterns
8796
if builtin_exclude_spec.match_file(p):
97+
logger.debug(
98+
"Excluding {} because it is excluded by the built-in ignore patterns.",
99+
p,
100+
)
88101
continue
89102

90103
# Check relative ignores (Python 3.9's is_relative_to workaround)
@@ -93,6 +106,10 @@ def each_unignored_file(
93106
for np, nex in nested_excludes.items()
94107
if dirpath == np or np in dirpath.parents
95108
):
109+
logger.debug(
110+
"Excluding {} because it is explicitly excluded by nested ignore.",
111+
p,
112+
)
96113
continue
97114

98115
yield p

0 commit comments

Comments
 (0)