From 1154f61f816ec03913dad8297ad910846399338e Mon Sep 17 00:00:00 2001 From: Nick Hastings Date: Sat, 15 Jun 2024 12:23:28 -0400 Subject: [PATCH] Fix invalid escape sequence warnings --- ambuild2/frontend/v2_2/tools/fxc.py | 2 +- ambuild2/frontend/v2_2/vs/export_vcxproj.py | 10 +++++----- ambuild2/util.py | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ambuild2/frontend/v2_2/tools/fxc.py b/ambuild2/frontend/v2_2/tools/fxc.py index d145ffa9..a3d4a8db 100644 --- a/ambuild2/frontend/v2_2/tools/fxc.py +++ b/ambuild2/frontend/v2_2/tools/fxc.py @@ -137,7 +137,7 @@ def fxc_helper_tool(): var_prefixes = [] for source_file in args.sources: - m = re.match('([^.]+)\.([^.]+)\.([^.]+)\.h', source_file) + m = re.match(r'([^.]+)\.([^.]+)\.([^.]+)\.h', source_file) var_prefix = m.group(2) if m is None: raise Exception('Sources must be in objname.varprefix.entrypoint.h form') diff --git a/ambuild2/frontend/v2_2/vs/export_vcxproj.py b/ambuild2/frontend/v2_2/vs/export_vcxproj.py index 9579334d..78faab2d 100644 --- a/ambuild2/frontend/v2_2/vs/export_vcxproj.py +++ b/ambuild2/frontend/v2_2/vs/export_vcxproj.py @@ -67,10 +67,10 @@ def export_body(cm, node, xml): if win_sdk_version: xml.tag('WindowsTargetPlatformVersion', win_sdk_version.rstrip('\\')) - xml.tag('Import', Project = '$(VCTargetsPath)\Microsoft.Cpp.Default.props') + xml.tag('Import', Project = '$(VCTargetsPath)\\Microsoft.Cpp.Default.props') export_configuration_properties(node, xml) - xml.tag('Import', Project = '$(VCTargetsPath)\Microsoft.Cpp.props') + xml.tag('Import', Project = '$(VCTargetsPath)\\Microsoft.Cpp.props') with xml.block('ImportGroup', Label = 'ExtensionSettings'): pass export_configuration_user_props(node, xml) @@ -87,7 +87,7 @@ def export_body(cm, node, xml): export_source_files(node, xml) - xml.tag('Import', Project = '$(VCTargetsPath)\Microsoft.cpp.targets') + xml.tag('Import', Project = '$(VCTargetsPath)\\Microsoft.cpp.targets') with xml.block('ImportGroup', Label = 'ExtensionTargets'): pass @@ -137,8 +137,8 @@ def export_configuration_user_props(node, xml): condition = condition_for(builder) with xml.block('ImportGroup', Condition = condition, Label = 'PropertySheets'): xml.tag('Import', - Project = "$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props", - Condition = "exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')", + Project = "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props", + Condition = "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')", Label = "LocalAppDataPlatform") def export_configuration_paths(node, xml): diff --git a/ambuild2/util.py b/ambuild2/util.py index 5a4de2da..eda5e78f 100644 --- a/ambuild2/util.py +++ b/ambuild2/util.py @@ -439,10 +439,10 @@ def ParseGCCDeps(text): new_text = '' state = sReadIncludes - for line in re.split('\n+', text): + for line in re.split(r'\n+', text): line = line.replace('\r', '') if state == sReadIncludes: - m = re.match('[\.!x]\.*\s+(.+)\s*$', line) + m = re.match(r'[\.!x]\.*\s+(.+)\s*$', line) if m == None: state = sLookForIncludeGuard else: @@ -494,13 +494,13 @@ def ParseFXCDeps(out): new_text = '' for line in out.split('\n'): # The inclusion pattern is probably translated, but for now we ignore this possibilty. - m = re.match('Opening file \[.*\], stack top \[.*\]', line) + m = re.match(r'Opening file \[.*\], stack top \[.*\]', line) if m is not None: continue - m = re.match('Current working dir \[.*\]', line) + m = re.match(r'Current working dir \[.*\]', line) if m is not None: continue - m = re.match('Resolved to \[(.+)\]', line) + m = re.match(r'Resolved to \[(.+)\]', line) if m is not None: deps.append(m.group(1).strip()) continue @@ -512,7 +512,7 @@ def ParseSunDeps(text): deps = set() new_text = '' - for line in re.split('\n+', text): + for line in re.split(r'\n+', text): name = line.lstrip() if os.path.isfile(name): deps.add(name) @@ -767,4 +767,4 @@ def BuildDictFromTuple(tup): # Replace anything from a filename that doesn't convert to an identifier. def MakeLexicalFilename(file): - return re.sub('[^a-zA-Z0-9_]+', '_', file) + return re.sub(r'[^a-zA-Z0-9_]+', '_', file)