Skip to content

Commit e08e765

Browse files
committed
gh-117829 : small changes based on feedback
1 parent 617cf18 commit e08e765

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

Lib/zipapp.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,6 @@ def get_interpreter(archive):
179179
if f.read(2) == b'#!':
180180
return f.readline().strip().decode(shebang_encoding)
181181

182-
def _normalize_patterns(values: Iterable[str] | None) -> list[str]:
183-
"""
184-
Return patterns exactly as provided by the CLI (no comma splitting).
185-
Each item is stripped of surrounding whitespace; empty items are dropped.
186-
"""
187-
if not values:
188-
return []
189-
out: list[str] = []
190-
for v in values:
191-
v = v.strip()
192-
if v:
193-
out.append(v)
194-
return out
195-
196182
def _make_glob_filter(
197183
includes: Iterable[str] | None,
198184
excludes: Iterable[str] | None,
@@ -204,14 +190,25 @@ def _make_glob_filter(
204190
- Patterns are standard glob patterns as implemented by PurePath.match.
205191
- If 'includes' is empty, all files/dirs are initially eligible.
206192
- If any exclude pattern matches, the path is rejected.
207-
- Matching respects the current platform's path flavor (separators, case).
208193
"""
194+
195+
def _normalize_patterns(values: Iterable[str] | None) -> list[str]:
196+
"""
197+
Return patterns exactly as provided by the CLI (no comma splitting).
198+
Each item is stripped of surrounding whitespace; empty items are dropped.
199+
"""
200+
if not values:
201+
return []
202+
out: list[str] = []
203+
for v in values:
204+
v = v.strip()
205+
if v:
206+
out.append(v)
207+
return out
208+
209209
inc = _normalize_patterns(values=includes)
210210
exc = _normalize_patterns(values=excludes)
211211

212-
if not inc and not exc:
213-
return None
214-
215212
def _filter(rel: pathlib.Path) -> bool:
216213
# If includes were provided, at least one must match.
217214
if inc and not any(rel.match(pat) for pat in inc):

0 commit comments

Comments
 (0)