BaseTools: Move variable out of Global
Move single use list from GlobalData (gTempInfs) into the file that uses it as _TempInfs Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
committed by
Yonghong Zhu
parent
975478f6bb
commit
2b5c643ae8
@ -93,13 +93,6 @@ gIgnoreSource = False
|
|||||||
#
|
#
|
||||||
gFdfParser = None
|
gFdfParser = None
|
||||||
|
|
||||||
#
|
|
||||||
# If a module is built more than once with different PCDs or library classes
|
|
||||||
# a temporary INF file with same content is created, the temporary file is removed
|
|
||||||
# when build exits.
|
|
||||||
#
|
|
||||||
gTempInfs = []
|
|
||||||
|
|
||||||
BuildOptionPcd = []
|
BuildOptionPcd = []
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -55,6 +55,13 @@ gFileTimeStampCache = {} # {file path : file time stamp}
|
|||||||
## Dictionary used to store dependencies of files
|
## Dictionary used to store dependencies of files
|
||||||
gDependencyDatabase = {} # arch : {file path : [dependent files list]}
|
gDependencyDatabase = {} # arch : {file path : [dependent files list]}
|
||||||
|
|
||||||
|
#
|
||||||
|
# If a module is built more than once with different PCDs or library classes
|
||||||
|
# a temporary INF file with same content is created, the temporary file is removed
|
||||||
|
# when build exits.
|
||||||
|
#
|
||||||
|
_TempInfs = []
|
||||||
|
|
||||||
def GetVariableOffset(mapfilepath, efifilepath, varnames):
|
def GetVariableOffset(mapfilepath, efifilepath, varnames):
|
||||||
""" Parse map file to get variable offset in current EFI file
|
""" Parse map file to get variable offset in current EFI file
|
||||||
@param mapfilepath Map file absolution path
|
@param mapfilepath Map file absolution path
|
||||||
@ -280,18 +287,18 @@ def ProcessDuplicatedInf(Path, BaseName, Workspace):
|
|||||||
# If file exists, compare contents
|
# If file exists, compare contents
|
||||||
#
|
#
|
||||||
if os.path.exists(TempFullPath):
|
if os.path.exists(TempFullPath):
|
||||||
with open(str(Path), 'rb') as f1: Src = f1.read()
|
with open(str(Path), 'rb') as f1, open(TempFullPath, 'rb') as f2:
|
||||||
with open(TempFullPath, 'rb') as f2: Dst = f2.read()
|
if f1.read() == f2.read():
|
||||||
if Src == Dst:
|
return RtPath
|
||||||
return RtPath
|
_TempInfs.append(TempFullPath)
|
||||||
GlobalData.gTempInfs.append(TempFullPath)
|
|
||||||
shutil.copy2(str(Path), TempFullPath)
|
shutil.copy2(str(Path), TempFullPath)
|
||||||
return RtPath
|
return RtPath
|
||||||
|
|
||||||
## Remove temporary created INFs whose paths were saved in gTempInfs
|
## Remove temporary created INFs whose paths were saved in _TempInfs
|
||||||
#
|
#
|
||||||
def ClearDuplicatedInf():
|
def ClearDuplicatedInf():
|
||||||
for File in GlobalData.gTempInfs:
|
while _TempInfs:
|
||||||
|
File = _TempInfs.pop()
|
||||||
if os.path.exists(File):
|
if os.path.exists(File):
|
||||||
os.remove(File)
|
os.remove(File)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user