Closed scpeters closed 5 months ago
Some of the sequences in the regex patterns are not valid in python string literals (such as \(, so use raw strings instead (see related stack overflow answer). This fixes some SyntaxWarnings when running the script with python@3.12:
\(
SyntaxWarning
python@3.12
# without this script: ++ python3 detect_cmake_major_version.py /github/workspace/CMakeLists.txt /github/workspace/detect_cmake_major_version.py:15: SyntaxWarning: invalid escape sequence '\(' old_version = re.search('set *\( *PROJECT_MAJOR_VERSION +(\d+)', txt) /github/workspace/detect_cmake_major_version.py:16: SyntaxWarning: invalid escape sequence '\(' gazebo_version = re.search('set *\( *GAZEBO_MAJOR_VERSION +(\d+)', txt) /github/workspace/detect_cmake_major_version.py:17: SyntaxWarning: invalid escape sequence '\(' sdformat_version = re.search('set *\( *SDF_MAJOR_VERSION +(\d+)', txt) /github/workspace/detect_cmake_major_version.py:18: SyntaxWarning: invalid escape sequence '\(' ign_cmake_version = re.search('project *\( *ignition-[a-z\-_]+(\d+)', txt) /github/workspace/detect_cmake_major_version.py:19: SyntaxWarning: invalid escape sequence '\(' cmake_project_version = re.search('project *\(.*VERSION +(\d+)', txt) + PACKAGE_MAJOR_VERSION=8
Some of the sequences in the regex patterns are not valid in python string literals (such as
\(
, so use raw strings instead (see related stack overflow answer). This fixes someSyntaxWarning
s when running the script withpython@3.12
: