Merge pull request #29755 from aditya2907:feature_enhancements

Fix Python utility compatibility issues - #29755

### Problem

Several repository Python utilities emit invalid escape sequence
SyntaxWarnings under Python 3.13.

The Java test checker also attempts to parse non-Java assets as UTF-8,
causing UnicodeDecodeError, and relies on a global parser instance.

The Apple build utility accepts malformed CMake version strings because
one version separator is an unescaped regex wildcard.

### Changes

- Use raw strings for regular expressions and replacement templates.
- Skip non-Java files in the Java test checker.
- Use the current JavaParser instance instead of global state.
- Require literal dots in parsed CMake versions.

### Verification

- Compiled every tracked Python file with SyntaxWarning treated as an error.
- Ran the Java checker against modules/java/test successfully.
- Verified valid CMake versions are accepted and malformed versions rejected.
- Ran git diff --check.
This commit is contained in:
Aditya Suryawanshi
2026-08-22 15:37:32 +03:00
committed by GitHub
parent 17002c4cf7
commit c36dd6a35e
5 changed files with 24 additions and 23 deletions
+2 -2
View File
@@ -46,7 +46,7 @@ def get_xcode_version():
def get_xcode_setting(var, projectdir):
ret = check_output(["xcodebuild", "-showBuildSettings"], cwd = projectdir).decode('utf-8')
m = re.search("\s" + var + " = (.*)", ret)
m = re.search(r"\s" + var + r" = (.*)", ret)
if m:
return m.group(1)
else:
@@ -58,7 +58,7 @@ def get_cmake_version():
command line tools as a tuple of (major, minor, revision)
"""
ret = check_output(["cmake", "--version"]).decode('utf-8')
m = re.match(r'cmake\sversion\s+(\d+)\.(\d+).(\d+)', ret, flags=re.IGNORECASE)
m = re.match(r'cmake\s+version\s+(\d+)\.(\d+)\.(\d+)', ret, flags=re.IGNORECASE)
if m:
return (int(m.group(1)), int(m.group(2)), int(m.group(3)))
else: