## Dictionary used to store dependencies of files\r
gDependencyDatabase = {} # arch : {file path : [dependent files list]}\r
\r
+#\r
+# If a module is built more than once with different PCDs or library classes\r
+# a temporary INF file with same content is created, the temporary file is removed\r
+# when build exits.\r
+#\r
+_TempInfs = []\r
+\r
def GetVariableOffset(mapfilepath, efifilepath, varnames):\r
""" Parse map file to get variable offset in current EFI file \r
@param mapfilepath Map file absolution path\r
# If file exists, compare contents\r
#\r
if os.path.exists(TempFullPath):\r
- with open(str(Path), 'rb') as f1: Src = f1.read()\r
- with open(TempFullPath, 'rb') as f2: Dst = f2.read()\r
- if Src == Dst:\r
- return RtPath\r
- GlobalData.gTempInfs.append(TempFullPath)\r
+ with open(str(Path), 'rb') as f1, open(TempFullPath, 'rb') as f2: \r
+ if f1.read() == f2.read():\r
+ return RtPath\r
+ _TempInfs.append(TempFullPath)\r
shutil.copy2(str(Path), TempFullPath)\r
return RtPath\r
\r
-## Remove temporary created INFs whose paths were saved in gTempInfs\r
+## Remove temporary created INFs whose paths were saved in _TempInfs\r
#\r
def ClearDuplicatedInf():\r
- for File in GlobalData.gTempInfs:\r
+ while _TempInfs:\r
+ File = _TempInfs.pop()\r
if os.path.exists(File):\r
os.remove(File)\r
\r