From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id EF68E7803D7 for ; Tue, 12 Dec 2023 00:30:13 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=rLA2SUp5q8KmgwSmdTznBslhsEV/CnCrvsnqThzvO7w=; c=relaxed/simple; d=groups.io; h=From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Thread-Index:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding:Content-Language; s=20140610; t=1702341012; v=1; b=HeeQtjhu9hr+Q4t3UxxLDFucv1MTKHI2c72NknVLbMupunKuf+cPF3ip9WWKLNCDrchbm3vx zX3t5DRFjs0+60QDWxbwumRC30MrpCRQZTUe/dmf7PzXbqy4OK53EEms8SdzsMXi2JlX379UmyQ xO/3PmK/PDy0JXVTtqjOmBGU= X-Received: by 127.0.0.2 with SMTP id LOeOYY7687511xfwrLYNsue1; Mon, 11 Dec 2023 16:30:12 -0800 X-Received: from cxsh.intel-email.com (cxsh.intel-email.com [121.46.250.151]) by mx.groups.io with SMTP id smtpd.web11.1031.1702341011313864111 for ; Mon, 11 Dec 2023 16:30:12 -0800 X-Received: from cxsh.intel-email.com (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id A71FDDDA7B8 for ; Tue, 12 Dec 2023 08:30:08 +0800 (CST) X-Received: from localhost (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id A255BDDA7E9 for ; Tue, 12 Dec 2023 08:30:08 +0800 (CST) X-Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by cxsh.intel-email.com (Postfix) with SMTP id AB734DDA785 for ; Tue, 12 Dec 2023 08:30:05 +0800 (CST) X-Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP(SSL) for ; Tue, 12 Dec 2023 08:29:58 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming via groups.io" To: "'Joey Vagedes'" , Cc: "'Rebecca Cran'" , "'Bob Feng'" , "'Yuwei Chen'" References: <20231206202703.1568-1-joey.vagedes@gmail.com> <20231206202703.1568-2-joey.vagedes@gmail.com> In-Reply-To: <20231206202703.1568-2-joey.vagedes@gmail.com> Subject: =?UTF-8?B?W2VkazItZGV2ZWxdIOWbnuWkjTogW1BBVENIIHYxIDEvMV0gQmFzZVRvb2xzOiBSZXNvbHZlIHJlZ2V4IHN5bnRheCB3YXJuaW5ncw==?= Date: Tue, 12 Dec 2023 08:30:00 +0800 Message-ID: <008301da2c92$575952d0$060bf870$@byosoft.com.cn> MIME-Version: 1.0 Thread-Index: AQDhz6x0avTe+4ZHI8KdYu9SleQoAAIDOoEtsoVrWlA= Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,gaoliming@byosoft.com.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: SOCnvd1a1zPA7E34AR4GemYox7686176AA= Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=HeeQtjhu; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Joey: Does this change still work on old python version, such as Python 3.9?=20 Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: Joey Vagedes > =B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA12=D4=C27=C8=D5 4:27 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Rebecca Cran ; Liming Gao > ; Bob Feng ; Yuwei Chen > > =D6=F7=CC=E2: [PATCH v1 1/1] BaseTools: Resolve regex syntax warnings >=20 > 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. >=20 > Cc: Rebecca Cran > Cc: Liming Gao > Cc: Bob Feng > Cc: Yuwei Chen > Signed-off-by: Joey Vagedes > --- > BaseTools/Source/Python/AmlToC/AmlToC.py | 2 > +- > BaseTools/Source/Python/AutoGen/BuildEngine.py | 2 > +- > BaseTools/Source/Python/AutoGen/GenDepex.py | > 2 +- > BaseTools/Source/Python/AutoGen/GenMake.py | > 2 +- > BaseTools/Source/Python/AutoGen/IdfClassObject.py | 2 +- > BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 4 > ++-- > BaseTools/Source/Python/AutoGen/StrGather.py | 2 > +- > BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py | 2 > +- > BaseTools/Source/Python/Common/Expression.py | 16 > ++++++------- > BaseTools/Source/Python/Common/GlobalData.py | > 4 ++-- > BaseTools/Source/Python/Common/Misc.py | > 24 ++++++++++---------- > BaseTools/Source/Python/Common/ToolDefClassObject.py | 6 > ++--- > BaseTools/Source/Python/GenFds/FdfParser.py | 10 > ++++---- > BaseTools/Source/Python/GenFds/GenFds.py | 2 > +- > BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py | 12 > +++++----- > BaseTools/Source/Python/Trim/Trim.py | 18 > +++++++-------- > BaseTools/Source/Python/Workspace/DscBuildData.py | 8 > +++---- > BaseTools/Source/Python/Workspace/MetaFileParser.py | 2 +- > 18 files changed, 60 insertions(+), 60 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/AmlToC/AmlToC.py > b/BaseTools/Source/Python/AmlToC/AmlToC.py > index 346de7159de7..63931c9720c9 100644 > --- a/BaseTools/Source/Python/AmlToC/AmlToC.py > +++ b/BaseTools/Source/Python/AmlToC/AmlToC.py > @@ -17,7 +17,7 @@ from Common.BuildToolError import * > import sys >=20 > import os >=20 >=20 >=20 > -__description__ =3D """ >=20 > +__description__ =3D r""" >=20 > Convert an AML file to a .c file containing the AML bytecode stored in a C >=20 > array. By default, Tables\Dsdt.aml will generate Tables\Dsdt.c. >=20 > Tables\Dsdt.c will contain a C array named "dsdt_aml_code" that contains >=20 > diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py > b/BaseTools/Source/Python/AutoGen/BuildEngine.py > index 752a1a1f6a86..45b39d7878d5 100644 > --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py > +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py > @@ -306,7 +306,7 @@ class BuildRule: > _SubSectionList =3D [_InputFile, _OutputFile, _Command] >=20 >=20 >=20 > _PATH_SEP =3D "(+)" >=20 > - _FileTypePattern =3D re.compile("^[_a-zA-Z][_\-0-9a-zA-Z]*$") >=20 > + _FileTypePattern =3D re.compile(r"^[_a-zA-Z][_\-0-9a-zA-Z]*$") >=20 > _BinaryFileRule =3D FileBuildRule(TAB_DEFAULT_BINARY_FILE, [], > [os.path.join("$(OUTPUT_DIR)", "${s_name}")], >=20 > ["$(CP) ${src} ${dst}"], []) >=20 >=20 >=20 > diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py > b/BaseTools/Source/Python/AutoGen/GenDepex.py > index f2f2e9d65b5f..b6db6645a4fb 100644 > --- a/BaseTools/Source/Python/AutoGen/GenDepex.py > +++ b/BaseTools/Source/Python/AutoGen/GenDepex.py > @@ -126,7 +126,7 @@ class DependencyExpression: > # >=20 > # open and close brace must be taken as individual tokens >=20 > # >=20 > - TokenPattern =3D re.compile("(\(|\)|\{[^{}]+\{?[^{}]+\}?[ ]*\}|\w+)"= ) >=20 > + TokenPattern =3D re.compile(r"(\(|\)|\{[^{}]+\{?[^{}]+\}?[ ]*\}|\w+)= ") >=20 >=20 >=20 > ## Constructor >=20 > # >=20 > diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py > b/BaseTools/Source/Python/AutoGen/GenMake.py > index daec9c6d54b2..c416fe172fe5 100755 > --- a/BaseTools/Source/Python/AutoGen/GenMake.py > +++ b/BaseTools/Source/Python/AutoGen/GenMake.py > @@ -28,7 +28,7 @@ from Common.DataType import TAB_COMPILER_MSFT > gIncludePattern =3D > re.compile(r"^[ \t]*[#%]?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\( > ?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | > re.IGNORECASE) >=20 >=20 >=20 > ## Regular expression for matching macro used in header file inclusion >=20 > -gMacroPattern =3D re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE) >=20 > +gMacroPattern =3D re.compile(r"([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE) >=20 >=20 >=20 > gIsFileMap =3D {} >=20 >=20 >=20 > diff --git a/BaseTools/Source/Python/AutoGen/IdfClassObject.py > b/BaseTools/Source/Python/AutoGen/IdfClassObject.py > index a6b8123c2539..bb413c6a26e3 100644 > --- a/BaseTools/Source/Python/AutoGen/IdfClassObject.py > +++ b/BaseTools/Source/Python/AutoGen/IdfClassObject.py > @@ -18,7 +18,7 @@ import os > from Common.GlobalData import gIdentifierPattern >=20 > from .UniClassObject import StripComments >=20 >=20 >=20 > -IMAGE_TOKEN =3D re.compile('IMAGE_TOKEN *\(([A-Z0-9_]+) *\)', > re.MULTILINE | re.UNICODE) >=20 > +IMAGE_TOKEN =3D re.compile(r'IMAGE_TOKEN *\(([A-Z0-9_]+) *\)', > re.MULTILINE | re.UNICODE) >=20 >=20 >=20 > # >=20 > # Value of different image information block types >=20 > diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py > b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py > index d05410b32966..65a2176ca982 100755 > --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py > +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py > @@ -51,12 +51,12 @@ gInfSpecVersion =3D "0x00010017" > # >=20 > # Match name =3D variable >=20 > # >=20 > -gEfiVarStoreNamePattern =3D re.compile("\s*name\s*=3D\s*(\w+)") >=20 > +gEfiVarStoreNamePattern =3D re.compile(r"\s*name\s*=3D\s*(\w+)") >=20 > # >=20 > # The format of guid in efivarstore statement likes following and must b= e > correct: >=20 > # guid =3D {0xA04A27f4, 0xDF00, 0x4D42, {0xB5, 0x52, 0x39, 0x51, 0x13, 0x02, > 0x11, 0x3D}} >=20 > # >=20 > -gEfiVarStoreGuidPattern =3D re.compile("\s*guid\s*=3D\s*({.*?{.*?}\s*})"= ) >=20 > +gEfiVarStoreGuidPattern =3D re.compile(r"\s*guid\s*=3D\s*({.*?{.*?}\s*})= ") >=20 >=20 >=20 > # >=20 > # Template string to generic AsBuilt INF >=20 > diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py > b/BaseTools/Source/Python/AutoGen/StrGather.py > index eed30388bea1..9789f50ba4db 100644 > --- a/BaseTools/Source/Python/AutoGen/StrGather.py > +++ b/BaseTools/Source/Python/AutoGen/StrGather.py > @@ -54,7 +54,7 @@ NOT_REFERENCED =3D 'not referenced' > COMMENT_NOT_REFERENCED =3D ' ' + COMMENT + NOT_REFERENCED >=20 > CHAR_ARRAY_DEFIN =3D 'unsigned char' >=20 > COMMON_FILE_NAME =3D 'Strings' >=20 > -STRING_TOKEN =3D re.compile('STRING_TOKEN *\(([A-Z0-9_]+) *\)', > re.MULTILINE | re.UNICODE) >=20 > +STRING_TOKEN =3D re.compile(r'STRING_TOKEN *\(([A-Z0-9_]+) *\)', > re.MULTILINE | re.UNICODE) >=20 >=20 >=20 > EFI_HII_ARRAY_SIZE_LENGTH =3D 4 >=20 > EFI_HII_PACKAGE_HEADER_LENGTH =3D 4 >=20 > diff --git a/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py > b/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py > index f86c749c08c3..160e3a3cd321 100644 > --- a/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py > +++ b/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py > @@ -26,7 +26,7 @@ from Common.Misc import * > import json >=20 >=20 >=20 > ## Regular expression for splitting Dependency Expression string into tokens >=20 > -gDepexTokenPattern =3D re.compile("(\(|\)|\w+| \S+\.inf)") >=20 > +gDepexTokenPattern =3D re.compile(r"(\(|\)|\w+| \S+\.inf)") >=20 >=20 >=20 > ## Regular expression for match: PCD(xxxx.yyy) >=20 > gPCDAsGuidPattern =3D re.compile(r"^PCD\(.+\..+\)$") >=20 > diff --git a/BaseTools/Source/Python/Common/Expression.py > b/BaseTools/Source/Python/Common/Expression.py > index b62efe6f9be6..9d9cb0c92962 100644 > --- a/BaseTools/Source/Python/Common/Expression.py > +++ b/BaseTools/Source/Python/Common/Expression.py > @@ -41,8 +41,8 @@ ERR_EMPTY_EXPR =3D 'Empty expression is > not allowed.' > ERR_IN_OPERAND =3D 'Macro after IN operator can only be: > $(FAMILY), $(ARCH), $(TOOL_CHAIN_TAG) and $(TARGET).' >=20 >=20 >=20 > __ValidString =3D re.compile(r'[_a-zA-Z][_0-9a-zA-Z]*$') >=20 > -_ReLabel =3D re.compile('LABEL\((\w+)\)') >=20 > -_ReOffset =3D re.compile('OFFSET_OF\((\w+)\)') >=20 > +_ReLabel =3D re.compile(r'LABEL\((\w+)\)') >=20 > +_ReOffset =3D re.compile(r'OFFSET_OF\((\w+)\)') >=20 > PcdPattern =3D > re.compile(r'^[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-z_]*$') >=20 >=20 >=20 > ## SplitString >=20 > @@ -242,10 +242,10 @@ class ValueExpression(BaseExpression): >=20 >=20 >=20 >=20 > SymbolPattern =3D re.compile("(" >=20 > - > "\$\([A-Z][A-Z0-9_]*\)|\$\(\w+\.\w+\)|\w+\.\w+|" >=20 > - "&&|\|\||!(?!=3D)|" >=20 > - > "(?<=3D\W)AND(?=3D\W)|(?<=3D\W)OR(?=3D\W)|(?<=3D\W)NOT(?=3D\W)|(?<=3D\W)X= OR(?=3D > \W)|" >=20 > - > "(?<=3D\W)EQ(?=3D\W)|(?<=3D\W)NE(?=3D\W)|(?<=3D\W)GT(?=3D\W)|(?<=3D\W)LT(= ?=3D\W)|( > ?<=3D\W)GE(?=3D\W)|(?<=3D\W)LE(?=3D\W)" >=20 > + > r"\$\([A-Z][A-Z0-9_]*\)|\$\(\w+\.\w+\)|\w+\.\w+|" >=20 > + r"&&|\|\||!(?!=3D)|" >=20 > + > r"(?<=3D\W)AND(?=3D\W)|(?<=3D\W)OR(?=3D\W)|(?<=3D\W)NOT(?=3D\W)|(?<=3D\W)= XOR(? > =3D\W)|" >=20 > + > r"(?<=3D\W)EQ(?=3D\W)|(?<=3D\W)NE(?=3D\W)|(?<=3D\W)GT(?=3D\W)|(?<=3D\W)LT= (?=3D\W)| > (?<=3D\W)GE(?=3D\W)|(?<=3D\W)LE(?=3D\W)" >=20 > ")") >=20 >=20 >=20 > @staticmethod >=20 > @@ -737,7 +737,7 @@ class ValueExpression(BaseExpression): > self._Token =3D "'" + UStr + "'" >=20 > return self._Token >=20 > elif Expr.startswith('UINT'): >=20 > - Re =3D re.compile('(?:UINT8|UINT16|UINT32|UINT64)\((.+)\)') >=20 > + Re =3D > re.compile(r'(?:UINT8|UINT16|UINT32|UINT64)\((.+)\)') >=20 > try: >=20 > RetValue =3D Re.search(Expr).group(1) >=20 > except: >=20 > @@ -975,7 +975,7 @@ class ValueExpressionEx(ValueExpression): > TokenSpaceGuidName =3D '' >=20 > if Item.startswith(TAB_GUID) and > Item.endswith(')'): >=20 > try: >=20 > - TokenSpaceGuidName =3D > re.search('GUID\((\w+)\)', Item).group(1) >=20 > + TokenSpaceGuidName =3D > re.search(r'GUID\((\w+)\)', Item).group(1) >=20 > except: >=20 > pass >=20 > if TokenSpaceGuidName and > TokenSpaceGuidName in self._Symb: >=20 > diff --git a/BaseTools/Source/Python/Common/GlobalData.py > b/BaseTools/Source/Python/Common/GlobalData.py > index 197bd8366682..11849e863f53 100755 > --- a/BaseTools/Source/Python/Common/GlobalData.py > +++ b/BaseTools/Source/Python/Common/GlobalData.py > @@ -33,10 +33,10 @@ gDefaultStores =3D [] > gGuidDict =3D {} >=20 >=20 >=20 > # definition for a MACRO name. used to create regular expressions below= . >=20 > -_MacroNamePattern =3D "[A-Z][A-Z0-9_]*" >=20 > +_MacroNamePattern =3D r"[A-Z][A-Z0-9_]*" >=20 >=20 >=20 > ## Regular expression for matching macro used in DSC/DEC/INF file inclusion >=20 > -gMacroRefPattern =3D re.compile("\$\(({})\)".format(_MacroNamePattern), > re.UNICODE) >=20 > +gMacroRefPattern =3D re.compile(r"\$\(({})\)".format(_MacroNamePattern), > re.UNICODE) >=20 > gMacroDefPattern =3D re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+") >=20 > gMacroNamePattern =3D re.compile("^{}$".format(_MacroNamePattern)) >=20 >=20 >=20 > diff --git a/BaseTools/Source/Python/Common/Misc.py > b/BaseTools/Source/Python/Common/Misc.py > index 4be7957138a5..f87d9dbdba39 100755 > --- a/BaseTools/Source/Python/Common/Misc.py > +++ b/BaseTools/Source/Python/Common/Misc.py > @@ -41,16 +41,16 @@ from CommonDataClass.Exceptions import > BadExpression > from Common.caching import cached_property >=20 > import struct >=20 >=20 >=20 > -ArrayIndex =3D re.compile("\[\s*[0-9a-fA-FxX]*\s*\]") >=20 > +ArrayIndex =3D re.compile(r"\[\s*[0-9a-fA-FxX]*\s*\]") >=20 > ## Regular expression used to find out place holders in string template >=20 > -gPlaceholderPattern =3D re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | > re.UNICODE) >=20 > +gPlaceholderPattern =3D re.compile(r"\$\{([^$()\s]+)\}", re.MULTILINE | > re.UNICODE) >=20 >=20 >=20 > ## regular expressions for map file processing >=20 > -startPatternGeneral =3D re.compile("^Start[' ']+Length[' ']+Name[' ']+Class") >=20 > -addressPatternGeneral =3D re.compile("^Address[' ']+Publics by Value[' > ']+Rva\+Base") >=20 > -valuePatternGcc =3D re.compile('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$') >=20 > -pcdPatternGcc =3D re.compile('^([\da-fA-Fx]+) +([\da-fA-Fx]+)') >=20 > -secReGeneral =3D re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]? > +([.\w\$]+) +(\w+)', re.UNICODE) >=20 > +startPatternGeneral =3D re.compile(r"^Start[' ']+Length[' ']+Name[' ']+Class") >=20 > +addressPatternGeneral =3D re.compile(r"^Address[' ']+Publics by Value[' > ']+Rva\+Base") >=20 > +valuePatternGcc =3D re.compile(r'^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$') >=20 > +pcdPatternGcc =3D re.compile(r'^([\da-fA-Fx]+) +([\da-fA-Fx]+)') >=20 > +secReGeneral =3D re.compile(r'^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]? > +([.\w\$]+) +(\w+)', re.UNICODE) >=20 >=20 >=20 > StructPattern =3D re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$') >=20 >=20 >=20 > @@ -82,7 +82,7 @@ def GetVariableOffset(mapfilepath, efifilepath, > varnames): >=20 >=20 > if len(lines) =3D=3D 0: return None >=20 > firstline =3D lines[0].strip() >=20 > - if re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', > firstline): >=20 > + if re.match(r'^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', > firstline): >=20 > return _parseForXcodeAndClang9(lines, efifilepath, varnames) >=20 > if (firstline.startswith("Archive member included ") and >=20 > firstline.endswith(" file (symbol)")): >=20 > @@ -96,7 +96,7 @@ def _parseForXcodeAndClang9(lines, efifilepath, > varnames): > ret =3D [] >=20 > for line in lines: >=20 > line =3D line.strip() >=20 > - if status =3D=3D 0 and > (re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \ >=20 > + if status =3D=3D 0 and > (re.match(r'^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \ >=20 > or line =3D=3D "# Symbols:"): >=20 > status =3D 1 >=20 > continue >=20 > @@ -104,7 +104,7 @@ def _parseForXcodeAndClang9(lines, efifilepath, > varnames): > for varname in varnames: >=20 > if varname in line: >=20 > # cannot pregenerate this RegEx since it uses > varname from varnames. >=20 > - m =3D re.match('^([\da-fA-FxX]+)([\s\S]*)([_]*%s)$' = % > varname, line) >=20 > + m =3D re.match(r'^([\da-fA-FxX]+)([\s\S]*)([_]*%s)$'= % > varname, line) >=20 > if m is not None: >=20 > ret.append((varname, m.group(1))) >=20 > return ret >=20 > @@ -170,7 +170,7 @@ def _parseGeneral(lines, efifilepath, varnames): > status =3D 0 #0 - beginning of file; 1 - PE section definition; 2= - symbol > table >=20 > secs =3D [] # key =3D section name >=20 > varoffset =3D [] >=20 > - symRe =3D re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.:\\\\\w\?@\$-]+) > +([\da-fA-F]+)', re.UNICODE) >=20 > + symRe =3D re.compile(r'^([\da-fA-F]+):([\da-fA-F]+) +([\.:\\\\\w\?@\$-]+) > +([\da-fA-F]+)', re.UNICODE) >=20 >=20 >=20 > for line in lines: >=20 > line =3D line.strip() >=20 > @@ -1926,4 +1926,4 @@ def CopyDict(ori_dict): > # Remove the c/c++ comments: // and /* */ >=20 > # >=20 > def RemoveCComments(ctext): >=20 > - return re.sub('//.*?\n|/\*.*?\*/', '\n', ctext, flags=3Dre.S) >=20 > + return re.sub(r'//.*?\n|/\*.*?\*/', '\n', ctext, flags=3Dre.S) >=20 > diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py > b/BaseTools/Source/Python/Common/ToolDefClassObject.py > index 2b4b23849196..afc20a3c1719 100644 > --- a/BaseTools/Source/Python/Common/ToolDefClassObject.py > +++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py > @@ -30,9 +30,9 @@ from .DataType import TAB_TOD_DEFINES_TARGET, > TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\ > ## >=20 > # Static variables used for pattern >=20 > # >=20 > -gMacroRefPattern =3D re.compile('(DEF\([^\(\)]+\))') >=20 > -gEnvRefPattern =3D re.compile('(ENV\([^\(\)]+\))') >=20 > -gMacroDefPattern =3D re.compile("DEFINE\s+([^\s]+)") >=20 > +gMacroRefPattern =3D re.compile(r'(DEF\([^\(\)]+\))') >=20 > +gEnvRefPattern =3D re.compile(r'(ENV\([^\(\)]+\))') >=20 > +gMacroDefPattern =3D re.compile(r"DEFINE\s+([^\s]+)") >=20 > gDefaultToolsDefFile =3D "tools_def.txt" >=20 >=20 >=20 > ## ToolDefClassObject >=20 > diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py > b/BaseTools/Source/Python/GenFds/FdfParser.py > index a9a14ca2bb33..feb4c727794f 100644 > --- a/BaseTools/Source/Python/GenFds/FdfParser.py > +++ b/BaseTools/Source/Python/GenFds/FdfParser.py > @@ -65,11 +65,11 @@ ALIGNMENTS =3D {"Auto", "8", "16", "32", "64", "128", > "512", "1K", "4K", "32K", "6 > ALIGNMENT_NOAUTO =3D ALIGNMENTS - {"Auto"} >=20 > CR_LB_SET =3D {T_CHAR_CR, TAB_LINE_BREAK} >=20 >=20 >=20 > -RegionSizePattern =3D > compile("\s*(?P(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P(?:0x|0X)?[a-f > A-F0-9]+)\s*") >=20 > -RegionSizeGuidPattern =3D > compile("\s*(?P\w+\.\w+[\.\w\[\]]*)\s*\|\s*(?P\w+\.\w+[\.\w > \[\]]*)\s*") >=20 > -RegionOffsetPcdPattern =3D compile("\s*(?P\w+\.\w+[\.\w\[\]]*)\s*$= ") >=20 > -ShortcutPcdPattern =3D > compile("\s*\w+\s*=3D\s*(?P(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P >\w+\.\w+)\s*") >=20 > -BaseAddrValuePattern =3D compile('^0[xX][0-9a-fA-F]+') >=20 > +RegionSizePattern =3D > compile(r"\s*(?P(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P(?:0x|0X)?[= a > -fA-F0-9]+)\s*") >=20 > +RegionSizeGuidPattern =3D > compile(r"\s*(?P\w+\.\w+[\.\w\[\]]*)\s*\|\s*(?P\w+\.\w+[\.\w > \[\]]*)\s*") >=20 > +RegionOffsetPcdPattern =3D > compile(r"\s*(?P\w+\.\w+[\.\w\[\]]*)\s*$") >=20 > +ShortcutPcdPattern =3D > compile(r"\s*\w+\s*=3D\s*(?P(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P >\w+\.\w+)\s*") >=20 > +BaseAddrValuePattern =3D compile(r'^0[xX][0-9a-fA-F]+') >=20 > FileExtensionPattern =3D compile(r'([a-zA-Z][a-zA-Z0-9]*)') >=20 > TokenFindPattern =3D > compile(r'([a-zA-Z0-9\-]+|\$\(TARGET\)|\*)_([a-zA-Z0-9\-]+|\$\(TOOL_CHAI > N_TAG\)|\*)_([a-zA-Z0-9\-]+|\$\(ARCH\)|\*)') >=20 > AllIncludeFileList =3D [] >=20 > diff --git a/BaseTools/Source/Python/GenFds/GenFds.py > b/BaseTools/Source/Python/GenFds/GenFds.py > index 17b71b7cd347..b48fe761e051 100644 > --- a/BaseTools/Source/Python/GenFds/GenFds.py > +++ b/BaseTools/Source/Python/GenFds/GenFds.py > @@ -733,7 +733,7 @@ class GenFds(object): > if not os.path.exists(FfsPath[0]): >=20 > continue >=20 > MatchDict =3D {} >=20 > - ReFileEnds =3D > compile('\S+(.ui)$|\S+(fv.sec.txt)$|\S+(.pe32.txt)$|\S+(.te.txt)$|\S+(.pic.= t xt)$ > |\S+(.raw.txt)$|\S+(.ffs.txt)$') >=20 > + ReFileEnds =3D > compile(r'\S+(.ui)$|\S+(fv.sec.txt)$|\S+(.pe32.txt)$|\S+(.te.txt)$|\S+(.pic= . txt)$ > |\S+(.raw.txt)$|\S+(.ffs.txt)$') >=20 > FileList =3D os.listdir(FfsPath[0]) >=20 > for File in FileList: >=20 > Match =3D ReFileEnds.search(File) >=20 > diff --git > a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py > b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py > index d962ab0adda7..8750db998ffc 100644 > --- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py > +++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py > @@ -31,7 +31,7 @@ __copyright__ =3D "Copyright (c) 2008 - 2018, Intel > Corporation. All rights reserv > #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Internal Libraries > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 >=20 >=20 > #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Code > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > -symRe =3D re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.\-:\\\\\w\?@\$<>= ]+) > +([\da-fA-F]+)', re.UNICODE) >=20 > +symRe =3D re.compile(r'^([\da-fA-F]+):([\da-fA-F]+) +([\.\-:\\\\\w\?@\$<>]+) > +([\da-fA-F]+)', re.UNICODE) >=20 >=20 >=20 > def parsePcdInfoFromMapFile(mapfilepath, efifilepath): >=20 > """ Parse map file to get binary patch pcd information >=20 > @@ -49,7 +49,7 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath): >=20 >=20 > if len(lines) =3D=3D 0: return None >=20 > firstline =3D lines[0].strip() >=20 > - if re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', > firstline): >=20 > + if re.match(r'^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', > firstline): >=20 > return _parseForXcodeAndClang9(lines, efifilepath) >=20 > if (firstline.startswith("Archive member included ") and >=20 > firstline.endswith(" file (symbol)")): >=20 > @@ -59,12 +59,12 @@ def parsePcdInfoFromMapFile(mapfilepath, > efifilepath): > return _parseGeneral(lines, efifilepath) >=20 >=20 >=20 > def _parseForXcodeAndClang9(lines, efifilepath): >=20 > - valuePattern =3D > re.compile('^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_BinaryPatch_([\w]+))') >=20 > + valuePattern =3D > re.compile(r'^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_BinaryPatch_([\w]+))') >=20 > status =3D 0 >=20 > pcds =3D [] >=20 > for line in lines: >=20 > line =3D line.strip() >=20 > - if status =3D=3D 0 and > (re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \ >=20 > + if status =3D=3D 0 and > (re.match(r'^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \ >=20 > or line =3D=3D "# Symbols:"): >=20 > status =3D 1 >=20 > continue >=20 > @@ -77,7 +77,7 @@ def _parseForXcodeAndClang9(lines, efifilepath): >=20 >=20 > def _parseForGCC(lines, efifilepath): >=20 > """ Parse map file generated by GCC linker """ >=20 > - dataPattern =3D re.compile('^.data._gPcd_BinaryPatch_([\w_\d]+)$') >=20 > + dataPattern =3D re.compile(r'^.data._gPcd_BinaryPatch_([\w_\d]+)$') >=20 > status =3D 0 >=20 > imageBase =3D -1 >=20 > sections =3D [] >=20 > @@ -136,7 +136,7 @@ def _parseGeneral(lines, efifilepath): > status =3D 0 #0 - beginning of file; 1 - PE section definition; 2= - symbol > table >=20 > secs =3D [] # key =3D section name >=20 > bPcds =3D [] >=20 > - symPattern =3D re.compile('^[_]+gPcd_BinaryPatch_([\w]+)') >=20 > + symPattern =3D re.compile(r'^[_]+gPcd_BinaryPatch_([\w]+)') >=20 >=20 >=20 > for line in lines: >=20 > line =3D line.strip() >=20 > diff --git a/BaseTools/Source/Python/Trim/Trim.py > b/BaseTools/Source/Python/Trim/Trim.py > index 416935df5e90..6d7bc0551026 100644 > --- a/BaseTools/Source/Python/Trim/Trim.py > +++ b/BaseTools/Source/Python/Trim/Trim.py > @@ -28,15 +28,15 @@ __version__ =3D "%prog Version " + > __version_number__ > __copyright__ =3D "Copyright (c) 2007-2018, Intel Corporation. All right= s > reserved." >=20 >=20 >=20 > ## Regular expression for matching Line Control directive like "#line xxx" >=20 > -gLineControlDirective =3D re.compile('^\s*#(?:line)?\s+([0-9]+)\s+"*([^"]*)"') >=20 > +gLineControlDirective =3D re.compile(r'^\s*#(?:line)?\s+([0-9]+)\s+"*([^"]*)"') >=20 > ## Regular expression for matching "typedef struct" >=20 > -gTypedefPattern =3D re.compile("^\s*typedef\s+struct(\s+\w+)?\s*[{]*$", > re.MULTILINE) >=20 > +gTypedefPattern =3D re.compile(r"^\s*typedef\s+struct(\s+\w+)?\s*[{]*$", > re.MULTILINE) >=20 > ## Regular expression for matching "#pragma pack" >=20 > -gPragmaPattern =3D re.compile("^\s*#pragma\s+pack", re.MULTILINE) >=20 > +gPragmaPattern =3D re.compile(r"^\s*#pragma\s+pack", re.MULTILINE) >=20 > ## Regular expression for matching "typedef" >=20 > -gTypedef_SinglePattern =3D re.compile("^\s*typedef", re.MULTILINE) >=20 > +gTypedef_SinglePattern =3D re.compile(r"^\s*typedef", re.MULTILINE) >=20 > ## Regular expression for matching "typedef struct, typedef union, struct, > union" >=20 > -gTypedef_MulPattern =3D > re.compile("^\s*(typedef)?\s+(struct|union)(\s+\w+)?\s*[{]*$", > re.MULTILINE) >=20 > +gTypedef_MulPattern =3D > re.compile(r"^\s*(typedef)?\s+(struct|union)(\s+\w+)?\s*[{]*$", > re.MULTILINE) >=20 >=20 >=20 > # >=20 > # The following number pattern match will only match if following criteria is > met: >=20 > @@ -44,14 +44,14 @@ gTypedef_MulPattern =3D > re.compile("^\s*(typedef)?\s+(struct|union)(\s+\w+)?\s*[{] > # as the pattern is greedily match, so it is ok for the gDecNumberPatter= n or > gHexNumberPattern to grab the maximum match >=20 > # >=20 > ## Regular expression for matching HEX number >=20 > -gHexNumberPattern =3D > re.compile("(?<=3D[^a-zA-Z0-9_])(0[xX])([0-9a-fA-F]+)(U(?=3D$|[^a-zA-Z0-9_]= ))?") >=20 > +gHexNumberPattern =3D > re.compile(r"(?<=3D[^a-zA-Z0-9_])(0[xX])([0-9a-fA-F]+)(U(?=3D$|[^a-zA-Z0-9_= ]))?" > ) >=20 > ## Regular expression for matching decimal number with 'U' postfix >=20 > -gDecNumberPattern =3D > re.compile("(?<=3D[^a-zA-Z0-9_])([0-9]+)U(?=3D$|[^a-zA-Z0-9_])") >=20 > +gDecNumberPattern =3D > re.compile(r"(?<=3D[^a-zA-Z0-9_])([0-9]+)U(?=3D$|[^a-zA-Z0-9_])") >=20 > ## Regular expression for matching constant with 'ULL' 'LL' postfix >=20 > -gLongNumberPattern =3D > re.compile("(?<=3D[^a-zA-Z0-9_])(0[xX][0-9a-fA-F]+|[0-9]+)U?LL(?=3D$|[^a-= zA-Z0 > -9_])") >=20 > +gLongNumberPattern =3D > re.compile(r"(?<=3D[^a-zA-Z0-9_])(0[xX][0-9a-fA-F]+|[0-9]+)U?LL(?=3D$|[^a= -zA-Z > 0-9_])") >=20 >=20 >=20 > ## Regular expression for matching "Include ()" in asl file >=20 > -gAslIncludePattern =3D re.compile("^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", > re.MULTILINE) >=20 > +gAslIncludePattern =3D re.compile(r"^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", > re.MULTILINE) >=20 > ## Regular expression for matching C style #include "XXX.asl" in asl fil= e >=20 > gAslCIncludePattern =3D > re.compile(r'^(\s*)#include\s*[<"]\s*([-\\/\w.]+)\s*([>"])', re.MULTILINE= ) >=20 > ## Patterns used to convert EDK conventions to EDK2 ECP conventions >=20 > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py > b/BaseTools/Source/Python/Workspace/DscBuildData.py > index 8fd949dc50b6..817cdbe5f19c 100644 > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py > @@ -90,7 +90,7 @@ PcdMakefileHeader =3D ''' >=20 >=20 > WindowsCFLAGS =3D 'CFLAGS =3D $(CFLAGS) /wd4200 /wd4034 /wd4101 ' >=20 > LinuxCFLAGS =3D 'CFLAGS +=3D -Wno-pointer-to-int-cast -Wno-unused-variab= le ' >=20 > -PcdMakefileEnd =3D ''' >=20 > +PcdMakefileEnd =3D r''' >=20 > !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.common >=20 > !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app >=20 > ''' >=20 > @@ -110,7 +110,7 @@ LIBS =3D -lCommon > variablePattern =3D re.compile(r'[\t\s]*0[xX][a-fA-F0-9]+$') >=20 > SkuIdPattern =3D re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*$') >=20 > ## regular expressions for finding decimal and hex numbers >=20 > -Pattern =3D re.compile('^[1-9]\d*|0$') >=20 > +Pattern =3D re.compile(r'^[1-9]\d*|0$') >=20 > HexPattern =3D re.compile(r'0[xX][0-9a-fA-F]+$') >=20 > ## Regular expression for finding header file inclusions >=20 > from AutoGen.GenMake import gIncludePattern >=20 > @@ -2840,7 +2840,7 @@ class DscBuildData(PlatformBuildClassObject): > # start generating makefile >=20 > MakeApp =3D PcdMakefileHeader >=20 > if sys.platform =3D=3D "win32": >=20 > - MakeApp =3D MakeApp + 'APPFILE =3D %s\%s.exe\n' % > (self.OutputPath, PcdValueInitName) + 'APPNAME =3D %s\n' % > (PcdValueInitName) + 'OBJECTS =3D %s\%s.obj %s.obj\n' % (self.OutputPath, > PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + > 'INC =3D ' >=20 > + MakeApp =3D MakeApp + r'APPFILE =3D %s\%s.exe\n' % > (self.OutputPath, PcdValueInitName) + r'APPNAME =3D %s\n' % > (PcdValueInitName) + r'OBJECTS =3D %s\%s.obj %s.obj\n' % (self.OutputPath= , > PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + > 'INC =3D ' >=20 > else: >=20 > MakeApp =3D MakeApp + PcdGccMakefile >=20 > MakeApp =3D MakeApp + 'APPFILE =3D %s/%s\n' % > (self.OutputPath, PcdValueInitName) + 'APPNAME =3D %s\n' % > (PcdValueInitName) + 'OBJECTS =3D %s/%s.o %s.o\n' % (self.OutputPath, > PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + \ >=20 > @@ -2950,7 +2950,7 @@ class DscBuildData(PlatformBuildClassObject): > MakeApp +=3D "$(OBJECTS) : %s\n" % include_file >=20 > if sys.platform =3D=3D "win32": >=20 > PcdValueCommonPath =3D > os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], > "Source\C\Common\PcdValueCommon.c")) >=20 > - MakeApp =3D MakeApp + '%s\PcdValueCommon.c : %s\n' % > (self.OutputPath, PcdValueCommonPath) >=20 > + MakeApp =3D MakeApp + r'%s\PcdValueCommon.c : %s\n' % > (self.OutputPath, PcdValueCommonPath) >=20 > MakeApp =3D MakeApp + '\tcopy /y %s $@\n' % > (PcdValueCommonPath) >=20 > else: >=20 > PcdValueCommonPath =3D > os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], > "Source/C/Common/PcdValueCommon.c")) >=20 > diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py > b/BaseTools/Source/Python/Workspace/MetaFileParser.py > index 3508591b281e..73a1654edb30 100644 > --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py > +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py > @@ -1897,7 +1897,7 @@ class DecParser(MetaFileParser): > self._SectionType =3D [] >=20 > ArchList =3D set() >=20 > PrivateList =3D set() >=20 > - Line =3D re.sub(',[\s]*', TAB_COMMA_SPLIT, self._CurrentLine) >=20 > + Line =3D re.sub(r',[\s]*', TAB_COMMA_SPLIT, self._CurrentLine) >=20 > for Item in Line[1:-1].split(TAB_COMMA_SPLIT): >=20 > if Item =3D=3D '': >=20 > EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, >=20 > -- > 2.43.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112346): https://edk2.groups.io/g/devel/message/112346 Mute This Topic: https://groups.io/mt/103121314/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-