From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>, Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [PATCH v1 1/1] BaseTools: Move variable out of Global
Date: Tue, 26 Jun 2018 17:12:34 -0700 [thread overview]
Message-ID: <e2e5212cdc02ba60f4832100bd5df5f5cca8c8fa.1530058332.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1530058332.git.jaben.carsey@intel.com>
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>
---
BaseTools/Source/Python/Common/GlobalData.py | 7 -------
BaseTools/Source/Python/Common/Misc.py | 21 +++++++++++++-------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py
index e3131b86cc60..afb3d8f0208b 100644
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -93,13 +93,6 @@ gIgnoreSource = False
#
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 = []
#
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 24706ebe500f..937c10a80f09 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -55,6 +55,13 @@ gFileTimeStampCache = {} # {file path : file time stamp}
## Dictionary used to store dependencies of files
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):
""" Parse map file to get variable offset in current EFI file
@param mapfilepath Map file absolution path
@@ -280,18 +287,18 @@ def ProcessDuplicatedInf(Path, BaseName, Workspace):
# If file exists, compare contents
#
if os.path.exists(TempFullPath):
- with open(str(Path), 'rb') as f1: Src = f1.read()
- with open(TempFullPath, 'rb') as f2: Dst = f2.read()
- if Src == Dst:
- return RtPath
- GlobalData.gTempInfs.append(TempFullPath)
+ with open(str(Path), 'rb') as f1, open(TempFullPath, 'rb') as f2:
+ if f1.read() == f2.read():
+ return RtPath
+ _TempInfs.append(TempFullPath)
shutil.copy2(str(Path), TempFullPath)
return RtPath
-## Remove temporary created INFs whose paths were saved in gTempInfs
+## Remove temporary created INFs whose paths were saved in _TempInfs
#
def ClearDuplicatedInf():
- for File in GlobalData.gTempInfs:
+ while _TempInfs:
+ File = _TempInfs.pop()
if os.path.exists(File):
os.remove(File)
--
2.16.2.windows.1
next parent reply other threads:[~2018-06-27 0:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1530058332.git.jaben.carsey@intel.com>
2018-06-27 0:12 ` Jaben Carsey [this message]
2018-06-27 5:17 ` [PATCH v1 1/1] BaseTools: Move variable out of Global Zhu, Yonghong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e2e5212cdc02ba60f4832100bd5df5f5cca8c8fa.1530058332.git.jaben.carsey@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox