Skip to content

Commit bab48eb

Browse files
authored
[fix] Fix fnmatch regex generation assert (#4753)
In some environments fnmatch.translate() returns a string that ends with \z instead of \Z. Their meaining is the same. Fixes #4737
1 parent 7ca6ef2 commit bab48eb

File tree

1 file changed

+3
-2
lines changed
  • tools/report-converter/codechecker_report_converter

1 file changed

+3
-2
lines changed

tools/report-converter/codechecker_report_converter/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ def trim_path_prefixes(path: str, prefixes: Optional[List[str]]) -> str:
7878
prefix += '/'
7979

8080
regex_str = fnmatch.translate(prefix)
81-
assert regex_str[-2:] == '\\Z', \
82-
r'fnmatch.translate should leave \\Z at the end of the matcher!'
81+
assert regex_str[-2:] in ('\\Z', '\\z'), \
82+
r'fnmatch.translate should leave \\Z or \\z ' \
83+
r'at the end of the matcher!'
8384

8485
prefix_matcher = re.compile(regex_str[:-2])
8586

0 commit comments

Comments
 (0)