BaseTools: Fix Python SyntaxWarning

- Windows paths must be escaped
- Regex should use raw strings

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2024-06-06 12:20:54 -06:00
parent f04bd1e3b8
commit 013e5c94d6
26 changed files with 101 additions and 101 deletions

View File

@ -89,12 +89,12 @@ class parser_lst(object):
return structs_file
def struct(self):#struct:{offset:name}
unit_num = re.compile('(\d+)')
offset1_re = re.compile('(\d+)\[')
pcdname_num_re = re.compile('\w+\[(\S+)\]')
pcdname_re = re.compile('\](.*)\<')
pcdname2_re = re.compile('(\w+)\[')
uint_re = re.compile('\<(\S+)\>')
unit_num = re.compile(r'(\d+)')
offset1_re = re.compile(r'(\d+)\[')
pcdname_num_re = re.compile(r'\w+\[(\S+)\]')
pcdname_re = re.compile(r'\](.*)\<')
pcdname2_re = re.compile(r'(\w+)\[')
uint_re = re.compile(r'\<(\S+)\>')
name_format = re.compile(r'(?<!typedef)\s+struct (\w+) {.*?;', re.S)
name=name_format.findall(self.text)
info={}
@ -214,8 +214,8 @@ class Config(object):
#Parser .config file,return list[offset,name,guid,value,help]
def config_parser(self):
ids_re =re.compile('_ID:(\d+)',re.S)
id_re= re.compile('\s+')
ids_re =re.compile(r'_ID:(\d+)',re.S)
id_re= re.compile(r'\s+')
info = []
info_dict={}
with open(self.config, 'r') as text:
@ -435,7 +435,7 @@ class PATH(object):
def header(self,struct):
header={}
head_re = re.compile('typedef.*} %s;[\n]+(.*)(?:typedef|formset)'%struct,re.M|re.S)
head_re = re.compile(r'typedef.*} %s;[\n]+(.*)(?:typedef|formset)'%struct,re.M|re.S)
head_re2 = re.compile(r'#line[\s\d]+"(\S+h)"')
for i in list(self.lstinf.keys()):
with open(i,'r') as lst: