summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorPierre Gondois <pierre.gondois@arm.com>2025-04-30 14:48:04 +0200
committerLiming Gao <gaoliming@byosoft.com.cn>2025-07-01 09:51:38 +0800
commit583b64122c7797ef012f7db634420a12c2b89b62 (patch)
tree719880582ad2822d93a9d97bdd73f0d9fd1520ae /BaseTools/Source/Python
parentee791006781e821e1d415f15433bfa95b9e83500 (diff)
downloadedk2-583b64122c7797ef012f7db634420a12c2b89b62.zip
edk2-583b64122c7797ef012f7db634420a12c2b89b62.tar.gz
edk2-583b64122c7797ef012f7db634420a12c2b89b62.tar.bz2
BaseTools: UPT/Parser: Remove unnecessary code
Running the vulture tool on the UPT/Parser folder gave the following report. Remove the unnecessary code. - UPT/Parser/InfAsBuiltProcess.py:223: unused function 'GetInfsFromWorkSpace' (60% confidence) - UPT/Parser/InfAsBuiltProcess.py:237: unused function 'GetGuidVerFormLibInstance' (60% confidence) - UPT/Parser/InfParserMisc.py:211: unused attribute 'InfPeiDepexSection' (60% confidence) - UPT/Parser/InfParserMisc.py:212: unused attribute 'InfDxeDepexSection' (60% confidence) - UPT/Parser/InfParserMisc.py:213: unused attribute 'InfSmmDepexSection' (60% confidence) - UPT/Parser/InfSectionParser.py:231: unused attribute 'InfPeiDepexSection' (60% confidence) - UPT/Parser/InfSectionParser.py:232: unused attribute 'InfDxeDepexSection' (60% confidence) - UPT/Parser/InfSectionParser.py:233: unused attribute 'InfSmmDepexSection' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py66
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfParserMisc.py3
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfSectionParser.py3
3 files changed, 0 insertions, 72 deletions
diff --git a/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py b/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
index fb64619..fd0795e 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
@@ -215,69 +215,3 @@ def GetFileLineContent(FileName, WorkSpace, LineNo, OriginalString):
FileLinesList = ProcessLineExtender(FileLinesList)
return FileLinesList
-
-##
-# Get all INF files from current workspace
-#
-#
-def GetInfsFromWorkSpace(WorkSpace):
- InfFiles = []
- for top, dirs, files in os.walk(WorkSpace):
- dirs = dirs # just for pylint
- for File in files:
- if File.upper().endswith(".INF"):
- InfFiles.append(os.path.join(top, File))
-
- return InfFiles
-
-##
-# Get GUID and version from library instance file
-#
-#
-def GetGuidVerFormLibInstance(Guid, Version, WorkSpace, CurrentInfFileName):
- for InfFile in GetInfsFromWorkSpace(WorkSpace):
- try:
- if InfFile.strip().upper() == CurrentInfFileName.strip().upper():
- continue
- InfFile = InfFile.replace('\\', '/')
- if InfFile not in GlobalData.gLIBINSTANCEDICT:
- InfFileObj = open(InfFile, "r")
- GlobalData.gLIBINSTANCEDICT[InfFile] = InfFileObj
- else:
- InfFileObj = GlobalData.gLIBINSTANCEDICT[InfFile]
-
- except BaseException:
- Logger.Error("InfParser",
- ToolError.FILE_READ_FAILURE,
- ST.ERR_FILE_OPEN_FAILURE,
- File=InfFile)
- try:
- FileLinesList = InfFileObj.readlines()
- FileLinesList = ProcessLineExtender(FileLinesList)
-
- ReFindFileGuidPattern = re.compile(r"^\s*FILE_GUID\s*=.*$")
- ReFindVerStringPattern = re.compile(r"^\s*VERSION_STRING\s*=.*$")
-
- for Line in FileLinesList:
- if ReFindFileGuidPattern.match(Line):
- FileGuidString = Line
- if ReFindVerStringPattern.match(Line):
- VerString = Line
-
- if FileGuidString:
- FileGuidString = GetSplitValueList(FileGuidString, '=', 1)[1]
- if VerString:
- VerString = GetSplitValueList(VerString, '=', 1)[1]
-
- if FileGuidString.strip().upper() == Guid.upper() and \
- VerString.strip().upper() == Version.upper():
- return Guid, Version
-
- except BaseException:
- Logger.Error("InfParser", ToolError.FILE_READ_FAILURE, ST.ERR_FILE_OPEN_FAILURE, File=InfFile)
- finally:
- InfFileObj.close()
-
- return '', ''
-
-
diff --git a/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py b/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py
index eb768b9..fd0f819 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py
@@ -208,9 +208,6 @@ class InfParserSectionRoot(object):
self.InfPpiSection = None
self.InfGuidSection = None
self.InfDepexSection = None
- self.InfPeiDepexSection = None
- self.InfDxeDepexSection = None
- self.InfSmmDepexSection = None
self.InfBinariesSection = None
self.InfHeader = None
self.InfSpecialCommentSection = None
diff --git a/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py
index 474d373..4899e7d 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py
@@ -228,9 +228,6 @@ class InfSectionParser(InfDefinSectionParser,
self.InfPpiSection = InfPpiObject()
self.InfGuidSection = InfGuidObject()
self.InfDepexSection = InfDepexObject()
- self.InfPeiDepexSection = InfDepexObject()
- self.InfDxeDepexSection = InfDepexObject()
- self.InfSmmDepexSection = InfDepexObject()
self.InfBinariesSection = InfBinariesObject()
self.InfHeader = InfHeaderObject()
self.InfBinaryHeader = InfHeaderObject()