SCons: Fix Python 3.12 SyntaxError with regex escape sequences

(cherry picked from commit b362976504)
(cherry picked from commit df0ebc6dfc)
This commit is contained in:
Rémi Verschelde 2023-09-25 10:39:30 +02:00
parent 3196113206
commit a0bf366068
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 8 additions and 8 deletions

View File

@ -975,13 +975,13 @@ def get_compiler_version(env):
else: # TODO: Implement for MSVC
return None
match = re.search(
"(?:(?<=version )|(?<=\) )|(?<=^))"
"(?P<major>\d+)"
"(?:\.(?P<minor>\d*))?"
"(?:\.(?P<patch>\d*))?"
"(?:-(?P<metadata1>[0-9a-zA-Z-]*))?"
"(?:\+(?P<metadata2>[0-9a-zA-Z-]*))?"
"(?: (?P<date>[0-9]{8}|[0-9]{6})(?![0-9a-zA-Z]))?",
r"(?:(?<=version )|(?<=\) )|(?<=^))"
r"(?P<major>\d+)"
r"(?:\.(?P<minor>\d*))?"
r"(?:\.(?P<patch>\d*))?"
r"(?:-(?P<metadata1>[0-9a-zA-Z-]*))?"
r"(?:\+(?P<metadata2>[0-9a-zA-Z-]*))?"
r"(?: (?P<date>[0-9]{8}|[0-9]{6})(?![0-9a-zA-Z]))?",
version,
)
if match is not None:

View File

@ -442,7 +442,7 @@ def configure(env: "Environment"):
linker_version_str = subprocess.check_output(
[env.subst(env["LINK"]), "-Wl,--version"] + env.subst(env["LINKFLAGS"])
).decode("utf-8")
gnu_ld_version = re.search("^GNU ld [^$]*(\d+\.\d+)$", linker_version_str, re.MULTILINE)
gnu_ld_version = re.search(r"^GNU ld [^$]*(\d+\.\d+)$", linker_version_str, re.MULTILINE)
if not gnu_ld_version:
print(
"Warning: Creating export template binaries enabled for PCK embedding is currently only supported with GNU ld, not gold, LLD or mold."