diff options
| author | Jeff Epler <jepler@gmail.com> | 2021-03-15 18:07:51 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2021-03-15 18:10:43 -0500 |
| commit | 253385d9b76cf364808e88b9b84b94d5bf22ef7b (patch) | |
| tree | 6d966edb6cf279a45c03b3563e7fee14451ac637 | |
| parent | 0403a2cca59ed24c0a71486e29d701220e8c4cf7 (diff) | |
codeformat: use pathlib for correct(-er) processing of * vs ** in globs
| -rw-r--r-- | tools/codeformat.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/codeformat.py b/tools/codeformat.py index e9615ae56..141ad7112 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -30,6 +30,7 @@ import glob import fnmatch import itertools import os +import pathlib import re import subprocess @@ -80,7 +81,7 @@ def list_files(args, paths, exclusions=None, prefix=""): files = set() args = [os.path.join(prefix, arg) for arg in args] for pattern in paths: - files.update(fnmatch.filter(args, os.path.join(prefix, pattern))) + files.update(arg for arg in args if pathlib.Path(arg).match(pattern)) for pattern in exclusions or []: files.difference_update(fnmatch.filter(files, os.path.join(prefix, pattern))) return sorted(files) |
