Skip to content

Commit

Permalink
Fix invalid escape sequence warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
psychonic committed Jun 15, 2024
1 parent 324e4a2 commit 1154f61
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ambuild2/frontend/v2_2/tools/fxc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
10 changes: 5 additions & 5 deletions ambuild2/frontend/v2_2/vs/export_vcxproj.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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):
Expand Down
14 changes: 7 additions & 7 deletions ambuild2/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)

0 comments on commit 1154f61

Please sign in to comment.