From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 91E5E21B02845 for ; Tue, 26 Jun 2018 22:17:35 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jun 2018 22:17:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,277,1526367600"; d="scan'208";a="68064969" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga001.jf.intel.com with ESMTP; 26 Jun 2018 22:17:34 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 26 Jun 2018 22:17:34 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 26 Jun 2018 22:17:34 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.51]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0319.002; Wed, 27 Jun 2018 13:17:31 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH v1 1/1] BaseTools: Move variable out of Global Thread-Index: AQHUDauRf4keM6s6AEGcGr+K4qsl+6RzkN/A Date: Wed, 27 Jun 2018 05:17:31 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v1 1/1] BaseTools: Move variable out of Global X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2018 05:17:35 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Wednesday, June 27, 2018 8:13 AM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Zhu, Yonghong Subject: [PATCH v1 1/1] BaseTools: Move variable out of Global Move single use list from GlobalData (gTempInfs) into the file that uses it= as _TempInfs Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- 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/Sourc= e/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 =3D False # gFdfParser =3D None =20 -# -# If a module is built more than once with different PCDs or library class= es -# a temporary INF file with same content is created, the temporary file= is removed -# when build exits. -# -gTempInfs =3D [] - BuildOptionPcd =3D [] =20 # diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/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 =3D {} # {file path : file time s= tamp} ## Dictionary used to store dependencies of files gDependencyDatabase =3D {} # arch : {file path : [dependent files list]= } =20 +# +# If a module is built more than once with different PCDs or library=20 +classes # a temporary INF file with same content is created, the=20 +temporary file is removed # when build exits. +# +_TempInfs =3D [] + def GetVariableOffset(mapfilepath, efifilepath, varnames): """ Parse map file to get variable offset in current EFI file=20 @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 =3D f1.read() - with open(TempFullPath, 'rb') as f2: Dst =3D f2.read() - if Src =3D=3D Dst: - return RtPath - GlobalData.gTempInfs.append(TempFullPath) + with open(str(Path), 'rb') as f1, open(TempFullPath, 'rb') as f2:= =20 + if f1.read() =3D=3D f2.read(): + return RtPath + _TempInfs.append(TempFullPath) shutil.copy2(str(Path), TempFullPath) return RtPath =20 -## 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 =3D _TempInfs.pop() if os.path.exists(File): os.remove(File) =20 -- 2.16.2.windows.1