summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorPierre Gondois <pierre.gondois@arm.com>2025-04-30 14:45:13 +0200
committerLiming Gao <gaoliming@byosoft.com.cn>2025-07-01 09:51:38 +0800
commit2d6b8d5ac951ee432512ca28db41ce32d0616849 (patch)
tree409c5f34b6c452ff152fb78848ba6d215177c1b8 /BaseTools/Source/Python
parent70d53c2df096d1789061f21b56cba34558a0c46d (diff)
downloadedk2-2d6b8d5ac951ee432512ca28db41ce32d0616849.zip
edk2-2d6b8d5ac951ee432512ca28db41ce32d0616849.tar.gz
edk2-2d6b8d5ac951ee432512ca28db41ce32d0616849.tar.bz2
BaseTools: WorkSpace: Remove unnecessary code
Running the vulture tool on the WorkSpace folder gave the following report. Remove the unnecessary code. - Workspace/BuildClassObject.py:148: unused method 'IsSimpleTypeArray' (60% confidence) - Workspace/BuildClassObject.py:337: unused method 'SetPcdMode' (60% confidence) - Workspace/BuildClassObject.py:612: unused attribute 'DscSpecification' (60% confidence) - Workspace/DscBuildData.py:451: unused property 'DscSpecification' (60% confidence) - Workspace/DscBuildData.py:1253: unused method 'GetBuildOptionsByPkg' (60% confidence) - Workspace/DscBuildData.py:2064: unused method 'GetStarNum' (60% confidence) - Workspace/DscBuildData.py:3613: unused method 'AddModule' (60% confidence) - Workspace/DscBuildData.py:3650: unused method 'AddPcd' (60% confidence) - Workspace/InfBuildData.py:117: unused attribute '_TailComments' (60% confidence) - Workspace/InfBuildData.py:126: unused attribute '_BinaryModule' (60% confidence) - Workspace/MetaDataTable.py:114: unused method 'IsIntegral' (60% confidence) - Workspace/MetaDataTable.py:218: unused method 'GetFileTimeStamp' (60% confidence) - Workspace/MetaDataTable.py:230: unused method 'SetFileTimeStamp' (60% confidence) - Workspace/MetaDataTable.py:298: unused method 'GetCrossIndex' (60% confidence) - Workspace/MetaFileParser.py:161: unused attribute '_FileDir' (60% confidence) - Workspace/MetaFileParser.py:1187: unused method '_DecodeCODEData' (60% confidence) - Workspace/MetaFileParser.py:1796: unused attribute '_RestofValue' (60% confidence) - Workspace/MetaFileTable.py:31: unused attribute '_NumpyTab' (60% confidence) - Workspace/WorkspaceDatabase.py:136: unused class 'TransformObjectFactory' (60% confidence) - Workspace/WorkspaceDatabase.py:159: unused attribute 'TransformObject' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/Workspace/BuildClassObject.py13
-rw-r--r--BaseTools/Source/Python/Workspace/DscBuildData.py66
-rw-r--r--BaseTools/Source/Python/Workspace/InfBuildData.py2
-rw-r--r--BaseTools/Source/Python/Workspace/MetaDataTable.py46
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py6
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileTable.py1
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceDatabase.py10
7 files changed, 0 insertions, 144 deletions
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index ef87372..631e019 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -145,11 +145,6 @@ class PcdClassObject(object):
return True
return False
- def IsSimpleTypeArray(self):
- if self.IsArray() and self.BaseDatumType in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, "BOOLEAN"]:
- return True
- return False
-
@staticmethod
def GetPcdMaxSizeWorker(PcdString, MaxSize):
if PcdString.startswith("{") and PcdString.endswith("}"):
@@ -290,7 +285,6 @@ class StructurePcd(PcdClassObject):
self.PackageDecs = Packages
self.DefaultStoreName = [default_store]
self.DefaultValues = OrderedDict()
- self.PcdMode = None
self.SkuOverrideValues = OrderedDict()
self.StructName = None
self.PcdDefineLineNo = 0
@@ -334,9 +328,6 @@ class StructurePcd(PcdClassObject):
self.PcdFiledValueFromDscComponent[ModuleGuid][DimensionAttr][FieldName] = [Value.strip(), FileName, LineNo]
return self.PcdFiledValueFromDscComponent[ModuleGuid][DimensionAttr][FieldName]
- def SetPcdMode (self, PcdMode):
- self.PcdMode = PcdMode
-
def copy(self, PcdObject):
self.TokenCName = PcdObject.TokenCName if PcdObject.TokenCName else self.TokenCName
self.TokenSpaceGuidCName = PcdObject.TokenSpaceGuidCName if PcdObject.TokenSpaceGuidCName else PcdObject.TokenSpaceGuidCName
@@ -365,7 +356,6 @@ class StructurePcd(PcdClassObject):
self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs else self.PackageDecs
self.DefaultValues = PcdObject.DefaultValues if PcdObject.DefaultValues else self.DefaultValues
- self.PcdMode = PcdObject.PcdMode if PcdObject.PcdMode else self.PcdMode
self.DefaultValueFromDec = PcdObject.DefaultValueFromDec if PcdObject.DefaultValueFromDec else self.DefaultValueFromDec
self.DefaultValueFromDecInfo = PcdObject.DefaultValueFromDecInfo if PcdObject.DefaultValueFromDecInfo else self.DefaultValueFromDecInfo
self.SkuOverrideValues = PcdObject.SkuOverrideValues if PcdObject.SkuOverrideValues else self.SkuOverrideValues
@@ -383,7 +373,6 @@ class StructurePcd(PcdClassObject):
new_pcd.DefaultValueFromDec = self.DefaultValueFromDec
new_pcd.DefaultValueFromDecInfo = self.DefaultValueFromDecInfo
- new_pcd.PcdMode = self.PcdMode
new_pcd.StructName = self.DatumType
new_pcd.PcdDefineLineNo = self.PcdDefineLineNo
new_pcd.PkgPath = self.PkgPath
@@ -586,7 +575,6 @@ class PackageBuildClassObject(BuildData):
# @var PlatformName: To store value for PlatformName
# @var Guid: To store value for Guid
# @var Version: To store value for Version
-# @var DscSpecification: To store value for DscSpecification
# @var OutputDirectory: To store value for OutputDirectory
# @var FlashDefinition: To store value for FlashDefinition
# @var BuildNumber: To store value for BuildNumber
@@ -609,7 +597,6 @@ class PlatformBuildClassObject(BuildData):
self.PlatformName = ''
self.Guid = ''
self.Version = ''
- self.DscSpecification = ''
self.OutputDirectory = ''
self.FlashDefinition = ''
self.BuildNumber = ''
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 894cf2f..c8c2760 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -464,16 +464,6 @@ class DscBuildData(PlatformBuildClassObject):
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No PLATFORM_VERSION", File=self.MetaFile)
return self._Version
- ## Retrieve platform description file version
- @property
- def DscSpecification(self):
- if self._DscSpecification is None:
- if self._Header is None:
- self._GetHeaderInfo()
- if self._DscSpecification is None:
- EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No DSC_SPECIFICATION", File=self.MetaFile)
- return self._DscSpecification
-
## Retrieve OUTPUT_DIRECTORY
@property
def OutputDirectory(self):
@@ -1267,27 +1257,6 @@ class DscBuildData(PlatformBuildClassObject):
if ' ' + Option not in self._BuildOptions[CurKey]:
self._BuildOptions[CurKey] += ' ' + Option
return self._BuildOptions
- def GetBuildOptionsByPkg(self, Module, ModuleType):
-
- local_pkg = os.path.split(Module.LocalPkg())[0]
- if self._ModuleTypeOptions is None:
- self._ModuleTypeOptions = OrderedDict()
- if ModuleType not in self._ModuleTypeOptions:
- options = OrderedDict()
- self._ModuleTypeOptions[ ModuleType] = options
- RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch]
- for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4, Dummy5 in RecordList:
- if Dummy2 not in (TAB_COMMON,local_pkg.upper(),"EDKII"):
- continue
- Type = Dummy3
- if Type.upper() == ModuleType.upper():
- Key = (ToolChainFamily, ToolChain)
- if Key not in options or not ToolChain.endswith('_FLAGS') or Option.startswith('='):
- options[Key] = Option
- else:
- if ' ' + Option not in options[Key]:
- options[Key] += ' ' + Option
- return self._ModuleTypeOptions[ModuleType]
def GetBuildOptionsByModuleType(self, Edk, ModuleType):
if self._ModuleTypeOptions is None:
self._ModuleTypeOptions = OrderedDict()
@@ -2078,13 +2047,6 @@ class DscBuildData(PlatformBuildClassObject):
indicator += "->" + FieldName
return indicator
- def GetStarNum(self,Pcd):
- if not Pcd.IsArray():
- return 1
- elif Pcd.IsSimpleTypeArray():
- return len(Pcd.Capacity)
- else:
- return len(Pcd.Capacity) + 1
def GenerateDefaultValueAssignFunction(self, Pcd):
CApp = "// Default value in Dec \n"
CApp = CApp + "void Assign_%s_%s_Default_Value(%s *Pcd){\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.BaseDatumType)
@@ -3631,20 +3593,6 @@ class DscBuildData(PlatformBuildClassObject):
list(map(self.FilterSkuSettings, Pcds.values()))
return Pcds
- ## Add external modules
- #
- # The external modules are mostly those listed in FDF file, which don't
- # need "build".
- #
- # @param FilePath The path of module description file
- #
- def AddModule(self, FilePath):
- FilePath = NormPath(FilePath)
- if FilePath not in self.Modules:
- Module = ModuleBuildClassObject()
- Module.MetaFile = FilePath
- self.Modules.append(Module)
-
@property
def ToolChainFamily(self):
self._ToolChainFamily = TAB_COMPILER_MSFT
@@ -3666,20 +3614,6 @@ class DscBuildData(PlatformBuildClassObject):
self._ToolChainFamily = ToolDefinition[TAB_TOD_DEFINES_FAMILY][self._Toolchain]
return self._ToolChainFamily
- ## Add external PCDs
- #
- # The external PCDs are mostly those listed in FDF file to specify address
- # or offset information.
- #
- # @param Name Name of the PCD
- # @param Guid Token space guid of the PCD
- # @param Value Value of the PCD
- #
- def AddPcd(self, Name, Guid, Value):
- if (Name, Guid) not in self.Pcds:
- self.Pcds[Name, Guid] = PcdClassObject(Name, Guid, '', '', '', '', '', {}, False, None)
- self.Pcds[Name, Guid].DefaultValue = Value
-
@property
def DecPcds(self):
if self._DecPcds is None:
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 6339e49..fa047a7 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -114,7 +114,6 @@ class InfBuildData(ModuleBuildClassObject):
self._Target = Target
self._Toolchain = Toolchain
self._Platform = TAB_COMMON
- self._TailComments = None
self._BaseName = None
self._DxsFile = None
self._ModuleType = None
@@ -123,7 +122,6 @@ class InfBuildData(ModuleBuildClassObject):
self._Guid = None
self._Version = None
self._PcdIsDriver = None
- self._BinaryModule = None
self._Shadow = None
self._MakefileName = None
self._CustomMakefile = None
diff --git a/BaseTools/Source/Python/Workspace/MetaDataTable.py b/BaseTools/Source/Python/Workspace/MetaDataTable.py
index a20bd14..325d01a 100644
--- a/BaseTools/Source/Python/Workspace/MetaDataTable.py
+++ b/BaseTools/Source/Python/Workspace/MetaDataTable.py
@@ -110,14 +110,6 @@ class Table(object):
Tab = self.Db.GetTable(self.Table)
Tab.append(self._DUMMY_)
-
- def IsIntegral(self):
- tab = self.Db.GetTable(self.Table)
- Id = min([int(item[0]) for item in tab])
- if Id != -1:
- return False
- return True
-
def GetAll(self):
tab = self.Db.GetTable(self.Table)
return tab
@@ -209,27 +201,6 @@ class TableFile(Table):
return None
return RecordList[0][0]
- ## Get file timestamp of a given file
- #
- # @param FileId ID of file
- #
- # @retval timestamp TimeStamp value of given file in the table
- #
- def GetFileTimeStamp(self, FileId):
- QueryScript = "select TimeStamp from %s where ID = '%s'" % (self.Table, FileId)
- RecordList = self.Exec(QueryScript)
- if len(RecordList) == 0:
- return None
- return RecordList[0][0]
-
- ## Update the timestamp of a given file
- #
- # @param FileId ID of file
- # @param TimeStamp Time stamp of file
- #
- def SetFileTimeStamp(self, FileId, TimeStamp):
- self.Exec("update %s set TimeStamp=%s where ID='%s'" % (self.Table, TimeStamp, FileId))
-
## Get list of file with given type
#
# @param FileType Type value of file
@@ -287,20 +258,3 @@ class TableDataModel(Table):
Description = Item[0]
self.Insert(CrossIndex, Name, Description)
EdkLogger.verbose("Initialize table DataModel ... DONE!")
-
- ## Get CrossIndex
- #
- # Get a model's cross index from its name
- #
- # @param ModelName: Name of the model
- # @retval CrossIndex: CrossIndex of the model
- #
- def GetCrossIndex(self, ModelName):
- CrossIndex = -1
- SqlCommand = """select CrossIndex from DataModel where name = '""" + ModelName + """'"""
- self.Db.execute(SqlCommand)
- for Item in self.Db:
- CrossIndex = Item[0]
-
- return CrossIndex
-
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 50319bf..ed1ccb1 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -158,7 +158,6 @@ class MetaFileParser(object):
self._Arch = Arch
self._FileType = FileType
self.MetaFile = FilePath
- self._FileDir = self.MetaFile.Dir
self._Defines = {}
self._Packages = []
self._FileLocalMacros = {}
@@ -1183,9 +1182,6 @@ class DscParser(MetaFileParser):
def _LibraryInstanceParser(self):
self._ValueList[0] = self._CurrentLine
-
- def _DecodeCODEData(self):
- pass
## PCD sections parser
#
# [PcdsFixedAtBuild]
@@ -1794,8 +1790,6 @@ class DecParser(MetaFileParser):
self._include_flag = False
self._package_flag = False
- self._RestofValue = ""
-
## Parser starter
def Start(self):
Content = ''
diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py b/BaseTools/Source/Python/Workspace/MetaFileTable.py
index bebf906..7ff5f20 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileTable.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py
@@ -28,7 +28,6 @@ class MetaFileTable():
self.MetaFile = MetaFile
self.TableName = ""
self.DB = DB
- self._NumpyTab = None
self.CurrentContent = []
DB.TblFile.append([MetaFile.Name,
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index d955c78..553b149 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -132,15 +132,6 @@ class WorkspaceDatabase(object):
)
return BuildObject
- # placeholder for file format conversion
- class TransformObjectFactory:
- def __init__(self, WorkspaceDb):
- self.WorkspaceDb = WorkspaceDb
-
- # key = FilePath, Arch
- def __getitem__(self, Key):
- pass
-
## Constructor of WorkspaceDatabase
#
# @param DbPath Path of database file
@@ -156,7 +147,6 @@ class WorkspaceDatabase(object):
# conversion object for build or file format conversion purpose
self.BuildObject = WorkspaceDatabase.BuildObjectFactory(self)
- self.TransformObject = WorkspaceDatabase.TransformObjectFactory(self)
## Summarize all packages in the database