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>
This commit is contained in:
committed by
mergify[bot]
parent
89705ad6c6
commit
9f0061a03b
@ -306,7 +306,7 @@ class BuildRule:
|
||||
_SubSectionList = [_InputFile, _OutputFile, _Command]
|
||||
|
||||
_PATH_SEP = "(+)"
|
||||
_FileTypePattern = re.compile("^[_a-zA-Z][_\-0-9a-zA-Z]*$")
|
||||
_FileTypePattern = re.compile(r"^[_a-zA-Z][_\-0-9a-zA-Z]*$")
|
||||
_BinaryFileRule = FileBuildRule(TAB_DEFAULT_BINARY_FILE, [], [os.path.join("$(OUTPUT_DIR)", "${s_name}")],
|
||||
["$(CP) ${src} ${dst}"], [])
|
||||
|
||||
|
@ -126,7 +126,7 @@ class DependencyExpression:
|
||||
#
|
||||
# open and close brace must be taken as individual tokens
|
||||
#
|
||||
TokenPattern = re.compile("(\(|\)|\{[^{}]+\{?[^{}]+\}?[ ]*\}|\w+)")
|
||||
TokenPattern = re.compile(r"(\(|\)|\{[^{}]+\{?[^{}]+\}?[ ]*\}|\w+)")
|
||||
|
||||
## Constructor
|
||||
#
|
||||
|
@ -28,7 +28,7 @@ from Common.DataType import TAB_COMPILER_MSFT
|
||||
gIncludePattern = re.compile(r"^[ \t]*[#%]?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE)
|
||||
|
||||
## Regular expression for matching macro used in header file inclusion
|
||||
gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE)
|
||||
gMacroPattern = re.compile(r"([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE)
|
||||
|
||||
gIsFileMap = {}
|
||||
|
||||
|
@ -18,7 +18,7 @@ import os
|
||||
from Common.GlobalData import gIdentifierPattern
|
||||
from .UniClassObject import StripComments
|
||||
|
||||
IMAGE_TOKEN = re.compile('IMAGE_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE | re.UNICODE)
|
||||
IMAGE_TOKEN = re.compile(r'IMAGE_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE | re.UNICODE)
|
||||
|
||||
#
|
||||
# Value of different image information block types
|
||||
|
@ -51,12 +51,12 @@ gInfSpecVersion = "0x00010017"
|
||||
#
|
||||
# Match name = variable
|
||||
#
|
||||
gEfiVarStoreNamePattern = re.compile("\s*name\s*=\s*(\w+)")
|
||||
gEfiVarStoreNamePattern = re.compile(r"\s*name\s*=\s*(\w+)")
|
||||
#
|
||||
# The format of guid in efivarstore statement likes following and must be correct:
|
||||
# guid = {0xA04A27f4, 0xDF00, 0x4D42, {0xB5, 0x52, 0x39, 0x51, 0x13, 0x02, 0x11, 0x3D}}
|
||||
#
|
||||
gEfiVarStoreGuidPattern = re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})")
|
||||
gEfiVarStoreGuidPattern = re.compile(r"\s*guid\s*=\s*({.*?{.*?}\s*})")
|
||||
|
||||
#
|
||||
# Template string to generic AsBuilt INF
|
||||
|
@ -54,7 +54,7 @@ NOT_REFERENCED = 'not referenced'
|
||||
COMMENT_NOT_REFERENCED = ' ' + COMMENT + NOT_REFERENCED
|
||||
CHAR_ARRAY_DEFIN = 'unsigned char'
|
||||
COMMON_FILE_NAME = 'Strings'
|
||||
STRING_TOKEN = re.compile('STRING_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE | re.UNICODE)
|
||||
STRING_TOKEN = re.compile(r'STRING_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE | re.UNICODE)
|
||||
|
||||
EFI_HII_ARRAY_SIZE_LENGTH = 4
|
||||
EFI_HII_PACKAGE_HEADER_LENGTH = 4
|
||||
|
@ -26,7 +26,7 @@ from Common.Misc import *
|
||||
import json
|
||||
|
||||
## Regular expression for splitting Dependency Expression string into tokens
|
||||
gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)")
|
||||
gDepexTokenPattern = re.compile(r"(\(|\)|\w+| \S+\.inf)")
|
||||
|
||||
## Regular expression for match: PCD(xxxx.yyy)
|
||||
gPCDAsGuidPattern = re.compile(r"^PCD\(.+\..+\)$")
|
||||
|
Reference in New Issue
Block a user