]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Move variable out of Global
authorJaben Carsey <jaben.carsey@intel.com>
Wed, 27 Jun 2018 00:12:34 +0000 (08:12 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Thu, 28 Jun 2018 00:46:49 +0000 (08:46 +0800)
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>
BaseTools/Source/Python/Common/GlobalData.py
BaseTools/Source/Python/Common/Misc.py

index e3131b86cc60fe4226cb8c99328b65d9bb2a858d..afb3d8f0208b9200fb0d64c0099a6cc89b48e99f 100644 (file)
@@ -93,13 +93,6 @@ gIgnoreSource = False
 #\r
 gFdfParser = None\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
-gTempInfs = []\r
-\r
 BuildOptionPcd = []\r
 \r
 #\r
index 55e3c6f2281b4d3ede9e4687ee014475e9176d66..044ef8d62bfe62ea4573fb3b94c7eb6c567d5296 100644 (file)
@@ -55,6 +55,13 @@ gFileTimeStampCache = {}    # {file path : file time stamp}
 ## 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
@@ -280,18 +287,18 @@ def ProcessDuplicatedInf(Path, BaseName, Workspace):
     # 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