mirror of
https://github.com/opencv/opencv.git
synced 2026-09-25 04:09:57 +03:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user