Skip to content

BaseTools: Remove unused Python code #11037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions BaseTools/Source/Python/AutoGen/BuildEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=[TAB_CO
else:
EdkLogger.error("build", PARAMETER_MISSING, ExtraData="No rule file or string given")

self.SupportedToolChainFamilyList = SupportedFamily
self.RuleDatabase = tdict(True, 4) # {FileExt, ModuleType, Arch, Family : FileBuildRule object}
self.Ext2FileType = {} # {ext : file-type}
self.FileTypeList = set()
Expand All @@ -343,7 +342,6 @@ def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=[TAB_CO
self._ArchList = set()
self._FamilyList = []
self._TotalToolChainFamilySet = set()
self._RuleObjectList = [] # FileBuildRule object list
self._FileVersion = ""

self.Parse()
Expand Down
21 changes: 0 additions & 21 deletions BaseTools/Source/Python/AutoGen/GenMake.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,19 +447,14 @@ def __init__(self, ModuleAutoGen):
self.ResultFileList = []
self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"]

self.FileBuildTargetList = [] # [(src, target string)]
self.BuildTargetList = [] # [target string]
self.PendingBuildTargetList = [] # [FileBuildRule objects]
self.CommonFileDependency = []
self.FileListMacros = {}
self.ListFileMacros = {}
self.ObjTargetDict = OrderedDict()
self.FileCache = {}
self.LibraryBuildCommandList = []
self.LibraryFileList = []
self.LibraryMakefileList = []
self.LibraryBuildDirectoryList = []
self.SystemLibraryList = []
self.Macros = OrderedDict()
self.Macros["OUTPUT_DIR" ] = self._AutoGenObject.Macros["OUTPUT_DIR"]
self.Macros["DEBUG_DIR" ] = self._AutoGenObject.Macros["DEBUG_DIR"]
Expand Down Expand Up @@ -1157,21 +1152,6 @@ def ProcessDependentLibrary(self):
if not LibraryAutoGen.IsBinaryModule:
self.LibraryBuildDirectoryList.append(self.PlaceMacro(LibraryAutoGen.BuildDir, self.Macros))

## Return a list containing source file's dependencies
#
# @param FileList The list of source files
# @param ForceInculeList The list of files which will be included forcely
# @param SearchPathList The list of search path
#
# @retval dict The mapping between source file path and its dependencies
#
def GetFileDependency(self, FileList, ForceInculeList, SearchPathList):
Dependency = {}
for F in FileList:
Dependency[F] = GetDependencyList(self._AutoGenObject, self.FileCache, F, ForceInculeList, SearchPathList)
return Dependency


## CustomMakefile class
#
# This class encapsules makefie and its generation for module. It uses template to generate
Expand Down Expand Up @@ -1463,7 +1443,6 @@ class PlatformMakefile(BuildFile):
#
def __init__(self, PlatformAutoGen):
BuildFile.__init__(self, PlatformAutoGen)
self.ModuleBuildCommandList = []
self.ModuleMakefileList = []
self.IntermediateDirectoryList = []
self.ModuleBuildDirectoryList = []
Expand Down
17 changes: 0 additions & 17 deletions BaseTools/Source/Python/AutoGen/GenPcdDb.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,23 +435,6 @@ def GetListSize(self):
self.ListSize += self.ItemSize
return self.ListSize

## DbSkuHeadTableItemList
#
# The class holds the Sku header value table
#
class DbSkuHeadTableItemList (DbItemList):
def __init__(self, ItemSize, DataList=None, RawDataList=None):
DbItemList.__init__(self, ItemSize, DataList, RawDataList)

def PackData(self):
PackStr = "=LL"
Buffer = bytearray()
for Data in self.RawDataList:
Buffer += pack(PackStr,
GetIntegerValue(Data[0]),
GetIntegerValue(Data[1]))
return Buffer

## DbSizeTableItemList
#
# The class holds the size table
Expand Down
4 changes: 0 additions & 4 deletions BaseTools/Source/Python/AutoGen/GenVar.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def __init__(self, DefaultStoreMap, SkuIdMap):
self.DefaultStoreMap = DefaultStoreMap
self.SkuIdMap = SkuIdMap
self.VpdRegionSize = 0
self.VpdRegionOffset = 0
self.NVHeaderBuff = None
self.VarDefaultBuff = None
self.VarDeltaBuff = None
Expand All @@ -39,9 +38,6 @@ def append_variable(self, uefi_var):
def SetVpdRegionMaxSize(self, maxsize):
self.VpdRegionSize = maxsize

def SetVpdRegionOffset(self, vpdoffset):
self.VpdRegionOffset = vpdoffset

def PatchNVStoreDefaultMaxSize(self, maxsize):
if not self.NVHeaderBuff:
return ""
Expand Down
45 changes: 0 additions & 45 deletions BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ def _InitWorker(self, Workspace, ModuleFile, Target, Toolchain, Arch, PlatformFi
self.AutoGenDepSet = set()
self.ReferenceModules = []
self.ConstPcd = {}
self.FileDependCache = {}

def __init_platform_info__(self):
pinfo = self.DataPipe.Get("P_Info")
Expand Down Expand Up @@ -677,50 +676,6 @@ def BuildOption(self):
self.BuildRuleOrder = ['.%s' % Ext for Ext in self.BuildRuleOrder.split()]
return RetVal

## Get include path list from tool option for the module build
#
# @retval list The include path list
#
@cached_property
def BuildOptionIncPathList(self):
#
# Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC
# is the former use /I , the Latter used -I to specify include directories
#
if self.PlatformInfo.ToolChainFamily in (TAB_COMPILER_MSFT):
BuildOptIncludeRegEx = gBuildOptIncludePatternMsft
elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC'):
BuildOptIncludeRegEx = gBuildOptIncludePatternOther
else:
#
# New ToolChainFamily, don't known whether there is option to specify include directories
#
return []

RetVal = []
for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'):
try:
FlagOption = self.BuildOption[Tool]['FLAGS']
except KeyError:
FlagOption = ''

IncPathList = [NormPath(Path, self.Macros) for Path in BuildOptIncludeRegEx.findall(FlagOption)]

#
# EDK II modules must not reference header files outside of the packages they depend on or
# within the module's directory tree. Report error if violation.
#
if GlobalData.gDisableIncludePathCheck == False:
for Path in IncPathList:
if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):
ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)
EdkLogger.error("build",
PARAMETER_INVALID,
ExtraData=ErrMsg,
File=str(self.MetaFile))
RetVal += IncPathList
return RetVal

## Return a list of files which can be built from source
#
# What kind of files can be built is determined by build rules in
Expand Down
6 changes: 0 additions & 6 deletions BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ def CollectVariables(self, DynamicPcdSet):

VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(), self.DscBuildDataObj.SkuIds)
VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
VariableInfo.SetVpdRegionOffset(VpdRegionBase)
Index = 0
for Pcd in sorted(DynamicPcdSet):
pcdname = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
Expand Down Expand Up @@ -990,11 +989,6 @@ def BuildOption(self):
def _BuildOptionWithToolDef(self, ToolDef):
return self._ExpandBuildOption(self.Platform.BuildOptions, ToolDef=ToolDef)

## Return the build options specific for EDK modules in this platform
@cached_property
def EdkBuildOption(self):
return self._ExpandBuildOption(self.Platform.BuildOptions, EDK_NAME)

## Return the build options specific for EDKII modules in this platform
@cached_property
def EdkIIBuildOption(self):
Expand Down
29 changes: 0 additions & 29 deletions BaseTools/Source/Python/AutoGen/UniClassObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ def Ucs2Search(name):
class StringDefClassObject(object):
def __init__(self, Name = None, Value = None, Referenced = False, Token = None, UseOtherLangDef = ''):
self.StringName = ''
self.StringNameByteList = []
self.StringValue = ''
self.StringValueByteList = ''
self.Token = 0
Expand All @@ -178,7 +177,6 @@ def __init__(self, Name = None, Value = None, Referenced = False, Token = None,

if Name is not None:
self.StringName = Name
self.StringNameByteList = UniToHexList(Name)
if Value is not None:
self.StringValue = Value + u'\x00' # Add a NULL at string tail
self.StringValueByteList = UniToHexList(self.StringValue)
Expand Down Expand Up @@ -360,13 +358,6 @@ def GetStringObject(self, Item):
Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)
self.AddStringToList(Name, Language, Value)

#
# Get include file list and load them
#
def GetIncludeFile(self, Item, Dir):
FileName = Item[Item.find(u'#include ') + len(u'#include ') :Item.find(u' ', len(u'#include '))][1:-1]
self.LoadUniFile(FileName)

#
# Pre-process before parse .uni file
#
Expand Down Expand Up @@ -600,26 +591,6 @@ def SetStringReferenced(self, Name):
Item = self.OrderedStringList[Lang][ItemIndexInList]
Item.Referenced = True

#
# Search the string in language definition by Name
#
def FindStringValue(self, Name, Lang):
if Name in self.OrderedStringDict[Lang]:
ItemIndexInList = self.OrderedStringDict[Lang][Name]
return self.OrderedStringList[Lang][ItemIndexInList]

return None

#
# Search the string in language definition by Token
#
def FindByToken(self, Token, Lang):
for Item in self.OrderedStringList[Lang]:
if Item.Token == Token:
return Item

return None

#
# Re-order strings and re-generate tokens
#
Expand Down
2 changes: 0 additions & 2 deletions BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,8 @@ def __init__(self, VarOffset, data, PcdDataType):
self.data = set()
try:
self.StorageWidth = MAX_SIZE_TYPE[self.PcdDataType]
self.ValidData = True
except:
self.StorageWidth = 0
self.ValidData = False

def __eq__(self, validObj):
return validObj and self.VarOffset == validObj.VarOffset
Expand Down
1 change: 0 additions & 1 deletion BaseTools/Source/Python/BPDG/BPDG.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from __future__ import absolute_import
import Common.LongFilePathOs as os
import sys
import encodings.ascii

from optparse import OptionParser
from Common import EdkLogger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@

class WindowsCapsuleSupportHelper(object):

def RegisterHelpers(self, obj):
fp = os.path.abspath(__file__)
obj.Register("PackageWindowsCapsuleFiles", WindowsCapsuleSupportHelper.PackageWindowsCapsuleFiles, fp)


@staticmethod
def PackageWindowsCapsuleFiles(OutputFolder, ProductName, ProductFmpGuid, CapsuleVersion_DotString,
CapsuleVersion_HexString, ProductFwProvider, ProductFwMfgName, ProductFwDesc, CapsuleFileName, PfxFile=None, PfxPass=None,
Expand Down
1 change: 0 additions & 1 deletion BaseTools/Source/Python/Ecc/CParser4/CLexer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated from C.g4 by ANTLR 4.7.1
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys


Expand Down
1 change: 0 additions & 1 deletion BaseTools/Source/Python/Ecc/CParser4/CParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# encoding: utf-8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys


Expand Down
1 change: 0 additions & 1 deletion BaseTools/Source/Python/Ecc/Check.py
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,6 @@ def FindPara(FilePath, Para, CallingLine):
if Line.startswith('%s = ' % Para):
Line = Line.strip()
return Line
break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch


return ''

Expand Down
62 changes: 0 additions & 62 deletions BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ def __init__(self, FileName):
self.CurrentLineNumber = 1
self.CurrentOffsetWithinLine = 0
self.TokenReleaceList = []
self.__Token = ""
self.__SkippedChars = ""

## __EndOfFile() method
#
Expand All @@ -98,21 +96,6 @@ def __EndOfFile(self):
else:
return False

## __EndOfLine() method
#
# Judge current buffer pos is at line end
#
# @param self The object pointer
# @retval True Current File buffer position is at line end
# @retval False Current File buffer position is NOT at line end
#
def __EndOfLine(self):
SizeOfCurrentLine = len(self.Profile.FileLinesList[self.CurrentLineNumber - 1])
if self.CurrentOffsetWithinLine >= SizeOfCurrentLine - 1:
return True
else:
return False

## Rewind() method
#
# Reset file data buffer to the initial state
Expand All @@ -123,25 +106,6 @@ def Rewind(self):
self.CurrentLineNumber = 1
self.CurrentOffsetWithinLine = 0

## __UndoOneChar() method
#
# Go back one char in the file buffer
#
# @param self The object pointer
# @retval True Successfully go back one char
# @retval False Not able to go back one char as file beginning reached
#
def __UndoOneChar(self):

if self.CurrentLineNumber == 1 and self.CurrentOffsetWithinLine == 0:
return False
elif self.CurrentOffsetWithinLine == 0:
self.CurrentLineNumber -= 1
self.CurrentOffsetWithinLine = len(self.__CurrentLine()) - 1
else:
self.CurrentOffsetWithinLine -= 1
return True

## __GetOneChar() method
#
# Move forward one char in the file buffer
Expand Down Expand Up @@ -211,32 +175,6 @@ def __SetCharValue(self, Line, Offset, Value):
def __CurrentLine(self):
return self.Profile.FileLinesList[self.CurrentLineNumber - 1]

## __InsertComma() method
#
# Insert ',' to replace PP
#
# @param self The object pointer
# @retval List current line contents
#
def __InsertComma(self, Line):


if self.Profile.FileLinesList[Line - 1][0] != T_CHAR_HASH:
BeforeHashPart = str(self.Profile.FileLinesList[Line - 1]).split(T_CHAR_HASH)[0]
if BeforeHashPart.rstrip().endswith(T_CHAR_COMMA) or BeforeHashPart.rstrip().endswith(';'):
return

if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(','):
return

if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(';'):
return

if str(self.Profile.FileLinesList[Line]).lstrip().startswith(',') or str(self.Profile.FileLinesList[Line]).lstrip().startswith(';'):
return

self.Profile.FileLinesList[Line - 1].insert(self.CurrentOffsetWithinLine, ',')

## PreprocessFile() method
#
# Preprocess file contents, replace comments with spaces.
Expand Down
Loading
Loading