Skip to content

Commit 253385d

Browse files
committed
codeformat: use pathlib for correct(-er) processing of * vs ** in globs
1 parent 0403a2c commit 253385d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/codeformat.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import fnmatch
3131
import itertools
3232
import os
33+
import pathlib
3334
import re
3435
import subprocess
3536

@@ -80,7 +81,7 @@ def list_files(args, paths, exclusions=None, prefix=""):
8081
files = set()
8182
args = [os.path.join(prefix, arg) for arg in args]
8283
for pattern in paths:
83-
files.update(fnmatch.filter(args, os.path.join(prefix, pattern)))
84+
files.update(arg for arg in args if pathlib.Path(arg).match(pattern))
8485
for pattern in exclusions or []:
8586
files.difference_update(fnmatch.filter(files, os.path.join(prefix, pattern)))
8687
return sorted(files)

0 commit comments

Comments
 (0)