summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenPatchPcdTable
diff options
context:
space:
mode:
authorJoey Vagedes via groups.io <joeyvagedes=microsoft.com@groups.io>2023-12-06 12:27:02 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-12-21 00:33:31 +0000
commit9f0061a03b61d282fbc0ba5be22155d06a5e64a1 (patch)
tree18a4fe05d2d43b7762bc70842790bacd3a3296ec /BaseTools/Source/Python/GenPatchPcdTable
parent89705ad6c6342e3bd635bed89608e25f74372600 (diff)
downloadedk2-9f0061a03b61d282fbc0ba5be22155d06a5e64a1.tar.gz
edk2-9f0061a03b61d282fbc0ba5be22155d06a5e64a1.tar.bz2
edk2-9f0061a03b61d282fbc0ba5be22155d06a5e64a1.zip
BaseTools: Resolve regex syntax warnings
Switches regex patterns to raw text to resolve python 3.12 syntax warnings in regards to invalid escape sequences, as is suggested by the re (regex) module in python. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
Diffstat (limited to 'BaseTools/Source/Python/GenPatchPcdTable')
-rw-r--r--BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
index d962ab0add..8750db998f 100644
--- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
+++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
@@ -31,7 +31,7 @@ __copyright__ = "Copyright (c) 2008 - 2018, Intel Corporation. All rights reserv
#====================================== Internal Libraries ========================================
#============================================== Code ===============================================
-symRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.\-:\\\\\w\?@\$<>]+) +([\da-fA-F]+)', re.UNICODE)
+symRe = re.compile(r'^([\da-fA-F]+):([\da-fA-F]+) +([\.\-:\\\\\w\?@\$<>]+) +([\da-fA-F]+)', re.UNICODE)
def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
""" Parse map file to get binary patch pcd information
@@ -49,7 +49,7 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
if len(lines) == 0: return None
firstline = lines[0].strip()
- if re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', firstline):
+ if re.match(r'^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', firstline):
return _parseForXcodeAndClang9(lines, efifilepath)
if (firstline.startswith("Archive member included ") and
firstline.endswith(" file (symbol)")):
@@ -59,12 +59,12 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
return _parseGeneral(lines, efifilepath)
def _parseForXcodeAndClang9(lines, efifilepath):
- valuePattern = re.compile('^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_BinaryPatch_([\w]+))')
+ valuePattern = re.compile(r'^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_BinaryPatch_([\w]+))')
status = 0
pcds = []
for line in lines:
line = line.strip()
- if status == 0 and (re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \
+ if status == 0 and (re.match(r'^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \
or line == "# Symbols:"):
status = 1
continue
@@ -77,7 +77,7 @@ def _parseForXcodeAndClang9(lines, efifilepath):
def _parseForGCC(lines, efifilepath):
""" Parse map file generated by GCC linker """
- dataPattern = re.compile('^.data._gPcd_BinaryPatch_([\w_\d]+)$')
+ dataPattern = re.compile(r'^.data._gPcd_BinaryPatch_([\w_\d]+)$')
status = 0
imageBase = -1
sections = []
@@ -136,7 +136,7 @@ def _parseGeneral(lines, efifilepath):
status = 0 #0 - beginning of file; 1 - PE section definition; 2 - symbol table
secs = [] # key = section name
bPcds = []
- symPattern = re.compile('^[_]+gPcd_BinaryPatch_([\w]+)')
+ symPattern = re.compile(r'^[_]+gPcd_BinaryPatch_([\w]+)')
for line in lines:
line = line.strip()