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:
@ -1112,7 +1112,7 @@ class Check(object):
|
||||
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
|
||||
for Record in RecordSet:
|
||||
Path = Record[1]
|
||||
Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '')
|
||||
Path = Path.upper().replace('\\X64', '').replace('\\IA32', '').replace('\\EBC', '').replace('\\IPF', '').replace('\\ARM', '')
|
||||
if Path in InfPathList:
|
||||
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, Record[2]):
|
||||
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, OtherMsg="The source file [%s] is existing in module directory but it is not described in INF file." % (Record[2]), BelongsToTable='File', BelongsToItem=Record[0])
|
||||
|
@ -435,7 +435,7 @@ class Configuration(object):
|
||||
# test that our dict and out class still match in contents.
|
||||
#
|
||||
if __name__ == '__main__':
|
||||
myconfig = Configuration("BaseTools\Source\Python\Ecc\config.ini")
|
||||
myconfig = Configuration("BaseTools\\Source\\Python\\Ecc\\config.ini")
|
||||
for each in myconfig.__dict__:
|
||||
if each == "Filename":
|
||||
continue
|
||||
|
@ -1841,14 +1841,14 @@ class DecParser(MetaFileParser):
|
||||
|
||||
if EccGlobalData.gConfig.UniCheckPCDInfo == '1' or EccGlobalData.gConfig.UniCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
|
||||
# check Description, Prompt information
|
||||
PatternDesc = re.compile('##\s*([\x21-\x7E\s]*)', re.S)
|
||||
PatternPrompt = re.compile('#\s+@Prompt\s+([\x21-\x7E\s]*)', re.S)
|
||||
PatternDesc = re.compile(r'##\s*([\x21-\x7E\s]*)', re.S)
|
||||
PatternPrompt = re.compile(r'#\s+@Prompt\s+([\x21-\x7E\s]*)', re.S)
|
||||
Description = None
|
||||
Prompt = None
|
||||
# check @ValidRange, @ValidList and @Expression format valid
|
||||
ErrorCodeValid = '0x0 <= %s <= 0xFFFFFFFF'
|
||||
PatternValidRangeIn = '(NOT)?\s*(\d+\s*-\s*\d+|0[xX][a-fA-F0-9]+\s*-\s*0[xX][a-fA-F0-9]+|LT\s*\d+|LT\s*0[xX][a-fA-F0-9]+|GT\s*\d+|GT\s*0[xX][a-fA-F0-9]+|LE\s*\d+|LE\s*0[xX][a-fA-F0-9]+|GE\s*\d+|GE\s*0[xX][a-fA-F0-9]+|XOR\s*\d+|XOR\s*0[xX][a-fA-F0-9]+|EQ\s*\d+|EQ\s*0[xX][a-fA-F0-9]+)'
|
||||
PatternValidRng = re.compile('^' + '(NOT)?\s*' + PatternValidRangeIn + '$')
|
||||
PatternValidRangeIn = r'(NOT)?\s*(\d+\s*-\s*\d+|0[xX][a-fA-F0-9]+\s*-\s*0[xX][a-fA-F0-9]+|LT\s*\d+|LT\s*0[xX][a-fA-F0-9]+|GT\s*\d+|GT\s*0[xX][a-fA-F0-9]+|LE\s*\d+|LE\s*0[xX][a-fA-F0-9]+|GE\s*\d+|GE\s*0[xX][a-fA-F0-9]+|XOR\s*\d+|XOR\s*0[xX][a-fA-F0-9]+|EQ\s*\d+|EQ\s*0[xX][a-fA-F0-9]+)'
|
||||
PatternValidRng = re.compile(r'^' + r'(NOT)?\s*' + PatternValidRangeIn + '$')
|
||||
for Comment in self._Comments:
|
||||
Comm = Comment[0].strip()
|
||||
if not Comm:
|
||||
@ -2071,7 +2071,7 @@ class UniParser(object):
|
||||
def CheckKeyValid(self, Key, Contents=None):
|
||||
if not Contents:
|
||||
Contents = self.FileIn
|
||||
KeyPattern = re.compile('#string\s+%s\s+.*?#language.*?".*?"' % Key, re.S)
|
||||
KeyPattern = re.compile(r'#string\s+%s\s+.*?#language.*?".*?"' % Key, re.S)
|
||||
if KeyPattern.search(Contents):
|
||||
return True
|
||||
return False
|
||||
|
@ -43,7 +43,7 @@ def GetArrayPattern():
|
||||
return p
|
||||
|
||||
def GetTypedefFuncPointerPattern():
|
||||
p = re.compile('[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
|
||||
p = re.compile(r'[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
|
||||
return p
|
||||
|
||||
def GetDB():
|
||||
|
Reference in New Issue
Block a user