From 9f0061a03b61d282fbc0ba5be22155d06a5e64a1 Mon Sep 17 00:00:00 2001 From: "Joey Vagedes via groups.io" Date: Wed, 6 Dec 2023 12:27:02 -0800 Subject: 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 Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Signed-off-by: Joey Vagedes Reviewed-by: Rebecca Cran --- BaseTools/Source/Python/Workspace/DscBuildData.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'BaseTools/Source/Python/Workspace/DscBuildData.py') diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 8fd949dc50..817cdbe5f1 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -90,7 +90,7 @@ PcdMakefileHeader = ''' WindowsCFLAGS = 'CFLAGS = $(CFLAGS) /wd4200 /wd4034 /wd4101 ' LinuxCFLAGS = 'CFLAGS += -Wno-pointer-to-int-cast -Wno-unused-variable ' -PcdMakefileEnd = ''' +PcdMakefileEnd = r''' !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.common !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app ''' @@ -110,7 +110,7 @@ LIBS = -lCommon variablePattern = re.compile(r'[\t\s]*0[xX][a-fA-F0-9]+$') SkuIdPattern = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*$') ## regular expressions for finding decimal and hex numbers -Pattern = re.compile('^[1-9]\d*|0$') +Pattern = re.compile(r'^[1-9]\d*|0$') HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$') ## Regular expression for finding header file inclusions from AutoGen.GenMake import gIncludePattern @@ -2840,7 +2840,7 @@ class DscBuildData(PlatformBuildClassObject): # start generating makefile MakeApp = PcdMakefileHeader if sys.platform == "win32": - MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\%s.obj %s.obj\n' % (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + 'INC = ' + MakeApp = MakeApp + r'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + r'APPNAME = %s\n' % (PcdValueInitName) + r'OBJECTS = %s\%s.obj %s.obj\n' % (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + 'INC = ' else: MakeApp = MakeApp + PcdGccMakefile MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' % (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + \ @@ -2950,7 +2950,7 @@ class DscBuildData(PlatformBuildClassObject): MakeApp += "$(OBJECTS) : %s\n" % include_file if sys.platform == "win32": PcdValueCommonPath = os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source\C\Common\PcdValueCommon.c")) - MakeApp = MakeApp + '%s\PcdValueCommon.c : %s\n' % (self.OutputPath, PcdValueCommonPath) + MakeApp = MakeApp + r'%s\PcdValueCommon.c : %s\n' % (self.OutputPath, PcdValueCommonPath) MakeApp = MakeApp + '\tcopy /y %s $@\n' % (PcdValueCommonPath) else: PcdValueCommonPath = os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon.c")) -- cgit v1.2.3