From nobody Mon Dec 23 01:51:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521073239511150.51345792026575; Wed, 14 Mar 2018 17:20:39 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B22762253FB67; Wed, 14 Mar 2018 17:14:10 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 E8AF720954BB9 for ; Wed, 14 Mar 2018 17:14:08 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2018 17:20:31 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 14 Mar 2018 17:20:31 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,307,1517904000"; d="scan'208";a="42123973" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Wed, 14 Mar 2018 17:20:27 -0700 Message-Id: <47f1c10f996e33b63e4fb092fa98bbb7251183c0.1521073063.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 1/2] BaseTools: Autogen - modify to use standard parent/child class relationships X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" use __new__ and __init__ to create/manage/initialize objects in standard fl= ow. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 93 ++++++++++++-------- 1 file changed, 54 insertions(+), 39 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 439e360955a3..5b09e0008ddd 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -159,8 +159,8 @@ ${tail_comments} # This class just implements the cache mechanism of AutoGen objects. # class AutoGen(object): - # database to maintain the objects of xxxAutoGen - _CACHE_ =3D {} # (BuildTarget, ToolChain) : {ARCH : {platform file:= AutoGen object}}} + # database to maintain the objects in each child class + __ObjectCache =3D {} # (BuildTarget, ToolChain, ARCH, platform file= ): AutoGen object =20 ## Factory method # @@ -174,24 +174,19 @@ class AutoGen(object): # @param *args The specific class related parameters # @param **kwargs The specific class related dict parameters # - def __new__(Class, Workspace, MetaFile, Target, Toolchain, Arch, *args= , **kwargs): + def __new__(cls, Workspace, MetaFile, Target, Toolchain, Arch, *args, = **kwargs): # check if the object has been created - Key =3D (Target, Toolchain) - if Key not in Class._CACHE_ or Arch not in Class._CACHE_[Key] \ - or MetaFile not in Class._CACHE_[Key][Arch]: - AutoGenObject =3D super(AutoGen, Class).__new__(Class) - # call real constructor - if not AutoGenObject._Init(Workspace, MetaFile, Target, Toolch= ain, Arch, *args, **kwargs): - return None - if Key not in Class._CACHE_: - Class._CACHE_[Key] =3D {} - if Arch not in Class._CACHE_[Key]: - Class._CACHE_[Key][Arch] =3D {} - Class._CACHE_[Key][Arch][MetaFile] =3D AutoGenObject - else: - AutoGenObject =3D Class._CACHE_[Key][Arch][MetaFile] + Key =3D (Target, Toolchain, Arch, MetaFile) + try: + # if it exists, just return it directly + return cls.__ObjectCache[Key] + except: + # it didnt exist. create it, cache it, then return it + cls.__ObjectCache[Key] =3D super(AutoGen, cls).__new__(cls) + return cls.__ObjectCache[Key] =20 - return AutoGenObject + def __init__ (self, Workspace, MetaFile, Target, Toolchain, Arch, *arg= s, **kwargs): + super(AutoGen, self).__init__(self, Workspace, MetaFile, Target, T= oolchain, Arch, *args, **kwargs) =20 ## hash() operator # @@ -221,10 +216,16 @@ class AutoGen(object): # architecture. This class will generate top level makefile. # class WorkspaceAutoGen(AutoGen): - ## Real constructor of WorkspaceAutoGen - # - # This method behaves the same as __init__ except that it needs explic= it invoke - # (in super class's __new__ method) + # call super().__init__ then call the worker function with different p= arameter count + def __init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args= , **kwargs): + try: + self._Init + except: + super(WorkspaceAutoGen, self).__init__(Workspace, MetaFile, Ta= rget, Toolchain, Arch, *args, **kwargs) + self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch,= *args, **kwargs) + self._Init =3D True + =20 + ## Initialize WorkspaceAutoGen # # @param WorkspaceDir Root directory of workspace # @param ActivePlatform Meta-file of active platform @@ -240,7 +241,7 @@ class WorkspaceAutoGen(AutoGen): # @param Caps Capsule list to be generated # @param SkuId SKU id from command line # - def _Init(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchL= ist, MetaFileDb, + def _InitWorker(self, WorkspaceDir, ActivePlatform, Target, Toolchain,= ArchList, MetaFileDb, BuildConfig, ToolDefinition, FlashDefinitionFile=3D'', Fds= =3DNone, Fvs=3DNone, Caps=3DNone, SkuId=3D'', UniFlag=3DNone, Progress=3DNone, BuildModule=3DNone): if Fds is None: @@ -1111,6 +1112,14 @@ class WorkspaceAutoGen(AutoGen): # file in order to generate makefile for platform. # class PlatformAutoGen(AutoGen): + # call super().__init__ then call the worker function with different p= arameter count + def __init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args= , **kwargs): + try: + self._Init + except: + super(PlatformAutoGen, self).__init__(self, Workspace, MetaFil= e, Target, Toolchain, Arch, *args, **kwargs) + self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch) + self._Init =3D True # # Used to store all PCDs for both PEI and DXE phase, in order to gener= ate=20 # correct PCD database @@ -1139,11 +1148,8 @@ class PlatformAutoGen(AutoGen): "0x10001" : 2, # TARGET_*********_****_***********_= ATTRIBUTE "0x00001" : 1} # ******_*********_****_***********_= ATTRIBUTE (Lowest) =20 - ## The real constructor of PlatformAutoGen + ## Initialize PlatformAutoGen # - # This method is not supposed to be called by users of PlatformAutoGe= n. It's - # only used by factory method __new__() to do real initialization wor= k for an - # object of PlatformAutoGen # # @param Workspace WorkspaceAutoGen object # @param PlatformFile Platform file (DSC file) @@ -1151,7 +1157,7 @@ class PlatformAutoGen(AutoGen): # @param Toolchain Name of tool chain # @param Arch arch of the platform supports # - def _Init(self, Workspace, PlatformFile, Target, Toolchain, Arch): + def _InitWorker(self, Workspace, PlatformFile, Target, Toolchain, Arch= ): EdkLogger.debug(EdkLogger.DEBUG_9, "AutoGen platform [%s] [%s]" % = (PlatformFile, Arch)) GlobalData.gProcessingFile =3D "%s [%s, %s, %s]" % (PlatformFile, = Arch, Toolchain, Target) =20 @@ -2776,15 +2782,29 @@ class PlatformAutoGen(AutoGen): # to the [depex] section in module's inf file. # class ModuleAutoGen(AutoGen): + # call super().__init__ then call the worker function with different p= arameter count + def __init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args= , **kwargs): + try: + self._Init + except: + super(ModuleAutoGen, self).__init__(Workspace, MetaFile, Targe= t, Toolchain, Arch, *args, **kwargs) + self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch,= *args) + self._Init =3D True + ## Cache the timestamps of metafiles of every module in a class variab= le # TimeDict =3D {} =20 - ## The real constructor of ModuleAutoGen - # - # This method is not supposed to be called by users of ModuleAutoGen.= It's - # only used by factory method __new__() to do real initialization wor= k for an - # object of ModuleAutoGen + def __new__(cls, Workspace, MetaFile, Target, Toolchain, Arch, *args, = **kwargs): + obj =3D super(ModuleAutoGen, cls).__new__(cls, Workspace, MetaFile= , Target, Toolchain, Arch, *args, **kwargs) + # check if this module is employed by active platform + if not PlatformAutoGen(Workspace, args[0], Target, Toolchain, Arch= ).ValidModule(MetaFile): + EdkLogger.verbose("Module [%s] for [%s] is not employed by act= ive platform\n" \ + % (MetaFile, Arch)) + return None + return obj + =20 + ## Initialize ModuleAutoGen # # @param Workspace EdkIIWorkspaceBuild object # @param ModuleFile The path of module file @@ -2793,7 +2813,7 @@ class ModuleAutoGen(AutoGen): # @param Arch The arch the module supports # @param PlatformFile Platform meta-file # - def _Init(self, Workspace, ModuleFile, Target, Toolchain, Arch, Platfo= rmFile): + def _InitWorker(self, Workspace, ModuleFile, Target, Toolchain, Arch, = PlatformFile): EdkLogger.debug(EdkLogger.DEBUG_9, "AutoGen module [%s] [%s]" % (M= oduleFile, Arch)) GlobalData.gProcessingFile =3D "%s [%s, %s, %s]" % (ModuleFile, Ar= ch, Toolchain, Target) =20 @@ -2802,11 +2822,6 @@ class ModuleAutoGen(AutoGen): =20 self.MetaFile =3D ModuleFile self.PlatformInfo =3D PlatformAutoGen(Workspace, PlatformFile, Tar= get, Toolchain, Arch) - # check if this module is employed by active platform - if not self.PlatformInfo.ValidModule(self.MetaFile): - EdkLogger.verbose("Module [%s] for [%s] is not employed by act= ive platform\n" \ - % (self.MetaFile, Arch)) - return False =20 self.SourceDir =3D self.MetaFile.SubDir self.SourceDir =3D mws.relpath(self.SourceDir, self.WorkspaceDir) --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Dec 23 01:51:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521073236689343.81731538356485; Wed, 14 Mar 2018 17:20:36 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4A3D12253FB59; Wed, 14 Mar 2018 17:14:10 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 CCA0520954BA8 for ; Wed, 14 Mar 2018 17:14:08 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2018 17:20:31 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 14 Mar 2018 17:20:31 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,307,1517904000"; d="scan'208";a="42123975" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Wed, 14 Mar 2018 17:20:28 -0700 Message-Id: <042e3dd6b9c1fcacb4835d1f62fb7c5e5d2727bb.1521073063.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 2/2] BaseTools: AutoGen should use is None not == None X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" change to the style we document as in use Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 138 ++++++++++---------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 5b09e0008ddd..2bea1adc5193 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -766,7 +766,7 @@ class WorkspaceAutoGen(AutoGen): for Fv in Fdf.Profile.FvDict: _GuidDict =3D {} for FfsFile in Fdf.Profile.FvDict[Fv].FfsList: - if FfsFile.InfFileName and FfsFile.NameGuid =3D=3D None: + if FfsFile.InfFileName and FfsFile.NameGuid is None: # # Get INF file GUID # @@ -939,13 +939,13 @@ class WorkspaceAutoGen(AutoGen): =20 ## Return the directory to store FV files def _GetFvDir(self): - if self._FvDir =3D=3D None: + if self._FvDir is None: self._FvDir =3D path.join(self.BuildDir, 'FV') return self._FvDir =20 ## Return the directory to store all intermediate and final files built def _GetBuildDir(self): - if self._BuildDir =3D=3D None: + if self._BuildDir is None: return self.AutoGenObjectList[0].BuildDir =20 ## Return the build output directory platform specifies @@ -973,7 +973,7 @@ class WorkspaceAutoGen(AutoGen): # @retval string Makefile directory # def _GetMakeFileDir(self): - if self._MakeFileDir =3D=3D None: + if self._MakeFileDir is None: self._MakeFileDir =3D self.BuildDir return self._MakeFileDir =20 @@ -982,7 +982,7 @@ class WorkspaceAutoGen(AutoGen): # @retval string Build command string # def _GetBuildCommand(self): - if self._BuildCommand =3D=3D None: + if self._BuildCommand is None: # BuildCommand should be all the same. So just get one from pl= atform AutoGen self._BuildCommand =3D self.AutoGenObjectList[0].BuildCommand return self._BuildCommand @@ -1331,7 +1331,7 @@ class PlatformAutoGen(AutoGen): for SkuName in Pcd.SkuInfoList: Sku =3D Pcd.SkuInfoList[SkuName] SkuId =3D Sku.SkuId - if SkuId =3D=3D None or SkuId =3D=3D '': + if SkuId is None or SkuId =3D=3D '': continue if len(Sku.VariableName) > 0: VariableGuidStructure =3D Sku.VariableGuidValue @@ -1642,7 +1642,7 @@ class PlatformAutoGen(AutoGen): # if the offset of a VPD is *, then it need to be = fixed up by third party tool. if not NeedProcessVpdMapFile and Sku.VpdOffset =3D= =3D "*": NeedProcessVpdMapFile =3D True - if self.Platform.VpdToolGuid =3D=3D None or se= lf.Platform.VpdToolGuid =3D=3D '': + if self.Platform.VpdToolGuid is None or self.P= latform.VpdToolGuid =3D=3D '': EdkLogger.error("Build", FILE_NOT_FOUND, \ "Fail to find third-party = BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in tools_d= ef.txt and VPD_TOOL_GUID need to be provided in DSC file.") =20 @@ -1654,7 +1654,7 @@ class PlatformAutoGen(AutoGen): for DscPcd in PlatformPcds: DscPcdEntry =3D self._PlatformPcds[DscPcd] if DscPcdEntry.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYN= AMIC_EX_VPD]: - if not (self.Platform.VpdToolGuid =3D=3D None or self.= Platform.VpdToolGuid =3D=3D ''): + if not (self.Platform.VpdToolGuid is None or self.Plat= form.VpdToolGuid =3D=3D ''): FoundFlag =3D False for VpdPcd in VpdFile._VpdArray.keys(): # This PCD has been referenced by module @@ -1734,7 +1734,7 @@ class PlatformAutoGen(AutoGen): =20 # if the offset of a VPD is *, then it nee= d to be fixed up by third party tool. VpdSkuMap[DscPcd] =3D SkuValueMap - if (self.Platform.FlashDefinition =3D=3D None or self.Platform= .FlashDefinition =3D=3D '') and \ + if (self.Platform.FlashDefinition is None or self.Platform.Fla= shDefinition =3D=3D '') and \ VpdFile.GetCount() !=3D 0: EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,=20 "Fail to get FLASH_DEFINITION definition i= n DSC file %s which is required when DSC contains VPD PCD." % str(self.Plat= form.MetaFile)) @@ -1824,7 +1824,7 @@ class PlatformAutoGen(AutoGen): =20 ## Return the platform build data object def _GetPlatform(self): - if self._Platform =3D=3D None: + if self._Platform is None: self._Platform =3D self.BuildDatabase[self.MetaFile, self.Arch= , self.BuildTarget, self.ToolChain] return self._Platform =20 @@ -1842,7 +1842,7 @@ class PlatformAutoGen(AutoGen): =20 ## Return the FDF file name def _GetFdfFile(self): - if self._FdfFile =3D=3D None: + if self._FdfFile is None: if self.Workspace.FdfFile !=3D "": self._FdfFile=3D mws.join(self.WorkspaceDir, self.Workspac= e.FdfFile) else: @@ -1855,7 +1855,7 @@ class PlatformAutoGen(AutoGen): =20 ## Return the directory to store all intermediate and final files built def _GetBuildDir(self): - if self._BuildDir =3D=3D None: + if self._BuildDir is None: if os.path.isabs(self.OutputDir): self._BuildDir =3D path.join( path.abspath(self.OutputDir), @@ -1875,7 +1875,7 @@ class PlatformAutoGen(AutoGen): # @retval string Makefile directory # def _GetMakeFileDir(self): - if self._MakeFileDir =3D=3D None: + if self._MakeFileDir is None: self._MakeFileDir =3D path.join(self.BuildDir, self.Arch) return self._MakeFileDir =20 @@ -1884,7 +1884,7 @@ class PlatformAutoGen(AutoGen): # @retval string Build command string # def _GetBuildCommand(self): - if self._BuildCommand =3D=3D None: + if self._BuildCommand is None: self._BuildCommand =3D [] if "MAKE" in self.ToolDefinition and "PATH" in self.ToolDefini= tion["MAKE"]: self._BuildCommand +=3D SplitOption(self.ToolDefinition["M= AKE"]["PATH"]) @@ -1906,7 +1906,7 @@ class PlatformAutoGen(AutoGen): # Get each tool defition for given tool chain from tools_def.txt and = platform # def _GetToolDefinition(self): - if self._ToolDefinitions =3D=3D None: + if self._ToolDefinitions is None: ToolDefinition =3D self.Workspace.ToolDef.ToolsDefTxtDictionary if TAB_TOD_DEFINES_COMMAND_TYPE not in self.Workspace.ToolDef.= ToolsDefTxtDatabase: EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No tools= found in configuration", @@ -1972,13 +1972,13 @@ class PlatformAutoGen(AutoGen): =20 ## Return the paths of tools def _GetToolDefFile(self): - if self._ToolDefFile =3D=3D None: + if self._ToolDefFile is None: self._ToolDefFile =3D os.path.join(self.MakeFileDir, "TOOLS_DE= F." + self.Arch) return self._ToolDefFile =20 ## Retrieve the toolchain family of given toolchain tag. Default to 'M= SFT'. def _GetToolChainFamily(self): - if self._ToolChainFamily =3D=3D None: + if self._ToolChainFamily is None: ToolDefinition =3D self.Workspace.ToolDef.ToolsDefTxtDatabase if TAB_TOD_DEFINES_FAMILY not in ToolDefinition \ or self.ToolChain not in ToolDefinition[TAB_TOD_DEFINES_FAM= ILY] \ @@ -1991,7 +1991,7 @@ class PlatformAutoGen(AutoGen): return self._ToolChainFamily =20 def _GetBuildRuleFamily(self): - if self._BuildRuleFamily =3D=3D None: + if self._BuildRuleFamily is None: ToolDefinition =3D self.Workspace.ToolDef.ToolsDefTxtDatabase if TAB_TOD_DEFINES_BUILDRULEFAMILY not in ToolDefinition \ or self.ToolChain not in ToolDefinition[TAB_TOD_DEFINES_BUI= LDRULEFAMILY] \ @@ -2005,19 +2005,19 @@ class PlatformAutoGen(AutoGen): =20 ## Return the build options specific for all modules in this platform def _GetBuildOptions(self): - if self._BuildOption =3D=3D None: + if self._BuildOption is None: self._BuildOption =3D self._ExpandBuildOption(self.Platform.Bu= ildOptions) return self._BuildOption =20 ## Return the build options specific for EDK modules in this platform def _GetEdkBuildOptions(self): - if self._EdkBuildOption =3D=3D None: + if self._EdkBuildOption is None: self._EdkBuildOption =3D self._ExpandBuildOption(self.Platform= .BuildOptions, EDK_NAME) return self._EdkBuildOption =20 ## Return the build options specific for EDKII modules in this platform def _GetEdkIIBuildOptions(self): - if self._EdkIIBuildOption =3D=3D None: + if self._EdkIIBuildOption is None: self._EdkIIBuildOption =3D self._ExpandBuildOption(self.Platfo= rm.BuildOptions, EDKII_NAME) return self._EdkIIBuildOption =20 @@ -2026,7 +2026,7 @@ class PlatformAutoGen(AutoGen): # @retval BuildRule object # def _GetBuildRule(self): - if self._BuildRule =3D=3D None: + if self._BuildRule is None: BuildRuleFile =3D None if TAB_TAT_DEFINES_BUILD_RULE_CONF in self.Workspace.TargetTxt= .TargetTxtDictionary: BuildRuleFile =3D self.Workspace.TargetTxt.TargetTxtDictio= nary[TAB_TAT_DEFINES_BUILD_RULE_CONF] @@ -2046,7 +2046,7 @@ class PlatformAutoGen(AutoGen): =20 ## Summarize the packages used by modules in this platform def _GetPackageList(self): - if self._PackageList =3D=3D None: + if self._PackageList is None: self._PackageList =3D set() for La in self.LibraryAutoGenList: self._PackageList.update(La.DependentPackageList) @@ -2071,19 +2071,19 @@ class PlatformAutoGen(AutoGen): =20 ## Get list of non-dynamic PCDs def _GetNonDynamicPcdList(self): - if self._NonDynamicPcdList =3D=3D None: + if self._NonDynamicPcdList is None: self.CollectPlatformDynamicPcds() return self._NonDynamicPcdList =20 ## Get list of dynamic PCDs def _GetDynamicPcdList(self): - if self._DynamicPcdList =3D=3D None: + if self._DynamicPcdList is None: self.CollectPlatformDynamicPcds() return self._DynamicPcdList =20 ## Generate Token Number for all PCD def _GetPcdTokenNumbers(self): - if self._PcdTokenNumber =3D=3D None: + if self._PcdTokenNumber is None: self._PcdTokenNumber =3D sdict() TokenNumber =3D 1 # @@ -2151,13 +2151,13 @@ class PlatformAutoGen(AutoGen): =20 ## Summarize ModuleAutoGen objects of all modules to be built for this= platform def _GetModuleAutoGenList(self): - if self._ModuleAutoGenList =3D=3D None: + if self._ModuleAutoGenList is None: self._GetAutoGenObjectList() return self._ModuleAutoGenList =20 ## Summarize ModuleAutoGen objects of all libraries to be built for th= is platform def _GetLibraryAutoGenList(self): - if self._LibraryAutoGenList =3D=3D None: + if self._LibraryAutoGenList is None: self._GetAutoGenObjectList() return self._LibraryAutoGenList =20 @@ -2221,9 +2221,9 @@ class PlatformAutoGen(AutoGen): LibraryPath =3D PlatformModule.LibraryClasses[Libr= aryClassName] else: LibraryPath =3D self.Platform.LibraryClasses[Libra= ryClassName, ModuleType] - if LibraryPath =3D=3D None or LibraryPath =3D=3D "": + if LibraryPath is None or LibraryPath =3D=3D "": LibraryPath =3D M.LibraryClasses[LibraryClassName] - if LibraryPath =3D=3D None or LibraryPath =3D=3D "= ": + if LibraryPath is None or LibraryPath =3D=3D "": EdkLogger.error("build", RESOURCE_NOT_AVAILABL= E, "Instance of library class [%s= ] is not found" % LibraryClassName, File=3Dself.MetaFile, @@ -2233,7 +2233,7 @@ class PlatformAutoGen(AutoGen): # for those forced library instance (NULL library), ad= d a fake library class if LibraryClassName.startswith("NULL"): LibraryModule.LibraryClass.append(LibraryClassObje= ct(LibraryClassName, [ModuleType])) - elif LibraryModule.LibraryClass =3D=3D None \ + elif LibraryModule.LibraryClass is None \ or len(LibraryModule.LibraryClass) =3D=3D 0 \ or (ModuleType !=3D 'USER_DEFINED' and ModuleType not in LibraryModule.LibraryCl= ass[0].SupModList): @@ -2249,7 +2249,7 @@ class PlatformAutoGen(AutoGen): else: LibraryModule =3D LibraryInstance[LibraryClassName] =20 - if LibraryModule =3D=3D None: + if LibraryModule is None: continue =20 if LibraryModule.ConstructorList !=3D [] and LibraryModule= not in Constructor: @@ -2447,7 +2447,7 @@ class PlatformAutoGen(AutoGen): Sku =3D PcdInModule.SkuInfoList[SkuId] if Sku.VariableGuid =3D=3D '': continue Sku.VariableGuidValue =3D GuidValue(Sku.VariableGuid, self= .PackageList, self.MetaFile.Path) - if Sku.VariableGuidValue =3D=3D None: + if Sku.VariableGuidValue is None: PackageList =3D "\n\t".join([str(P) for P in self.Pack= ageList]) EdkLogger.error( 'build', @@ -2510,12 +2510,12 @@ class PlatformAutoGen(AutoGen): M =3D LibraryConsumerList.pop() for LibraryName in M.Libraries: Library =3D self.Platform.LibraryClasses[LibraryName, ':du= mmy:'] - if Library =3D=3D None: + if Library is None: for Key in self.Platform.LibraryClasses.data.keys(): if LibraryName.upper() =3D=3D Key.upper(): Library =3D self.Platform.LibraryClasses[Key, = ':dummy:'] break - if Library =3D=3D None: + if Library is None: EdkLogger.warn("build", "Library [%s] is not found= " % LibraryName, File=3Dstr(M), ExtraData=3D"\t%s [%s]" % (str(Module), self.A= rch)) continue @@ -2570,7 +2570,7 @@ class PlatformAutoGen(AutoGen): # Key[1] -- TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE # if (Key[0] =3D=3D self.BuildRuleFamily and - (ModuleStyle =3D=3D None or len(Key) < 3 or (len(Key) > 2 = and Key[2] =3D=3D ModuleStyle))): + (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and = Key[2] =3D=3D ModuleStyle))): Target, ToolChain, Arch, CommandType, Attr =3D Key[1].spli= t('_') if Target =3D=3D self.BuildTarget or Target =3D=3D "*": if ToolChain =3D=3D self.ToolChain or ToolChain =3D=3D= "*": @@ -2942,7 +2942,7 @@ class ModuleAutoGen(AutoGen): =20 # Macros could be used in build_rule.txt (also Makefile) def _GetMacros(self): - if self._Macro =3D=3D None: + if self._Macro is None: self._Macro =3D sdict() self._Macro["WORKSPACE" ] =3D self.WorkspaceDir self._Macro["MODULE_NAME" ] =3D self.Name @@ -2982,7 +2982,7 @@ class ModuleAutoGen(AutoGen): =20 ## Return the module build data object def _GetModule(self): - if self._Module =3D=3D None: + if self._Module is None: self._Module =3D self.Workspace.BuildDatabase[self.MetaFile, s= elf.Arch, self.BuildTarget, self.ToolChain] return self._Module =20 @@ -3038,7 +3038,7 @@ class ModuleAutoGen(AutoGen): =20 ## Check if the module is library or not def _IsLibrary(self): - if self._LibraryFlag =3D=3D None: + if self._LibraryFlag is None: if self.Module.LibraryClass !=3D None and self.Module.LibraryC= lass !=3D []: self._LibraryFlag =3D True else: @@ -3051,7 +3051,7 @@ class ModuleAutoGen(AutoGen): =20 ## Return the directory to store intermediate files of the module def _GetBuildDir(self): - if self._BuildDir =3D=3D None: + if self._BuildDir is None: self._BuildDir =3D path.join( self.PlatformInfo.BuildDir, self.Arch, @@ -3063,14 +3063,14 @@ class ModuleAutoGen(AutoGen): =20 ## Return the directory to store the intermediate object files of the = mdoule def _GetOutputDir(self): - if self._OutputDir =3D=3D None: + if self._OutputDir is None: self._OutputDir =3D path.join(self.BuildDir, "OUTPUT") CreateDirectory(self._OutputDir) return self._OutputDir =20 ## Return the directory to store ffs file def _GetFfsOutputDir(self): - if self._FfsOutputDir =3D=3D None: + if self._FfsOutputDir is None: if GlobalData.gFdfParser !=3D None: self._FfsOutputDir =3D path.join(self.PlatformInfo.BuildDi= r, "FV", "Ffs", self.Guid + self.Name) else: @@ -3079,14 +3079,14 @@ class ModuleAutoGen(AutoGen): =20 ## Return the directory to store auto-gened source files of the mdoule def _GetDebugDir(self): - if self._DebugDir =3D=3D None: + if self._DebugDir is None: self._DebugDir =3D path.join(self.BuildDir, "DEBUG") CreateDirectory(self._DebugDir) return self._DebugDir =20 ## Return the path of custom file def _GetCustomMakefile(self): - if self._CustomMakefile =3D=3D None: + if self._CustomMakefile is None: self._CustomMakefile =3D {} for Type in self.Module.CustomMakefile: if Type in gMakeTypeMap: @@ -3194,7 +3194,7 @@ class ModuleAutoGen(AutoGen): # @retval list The token list of the dependency expression af= ter parsed # def _GetDepexTokenList(self): - if self._DepexList =3D=3D None: + if self._DepexList is None: self._DepexList =3D {} if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION= _FILE in self.FileTypes: return self._DepexList @@ -3230,7 +3230,7 @@ class ModuleAutoGen(AutoGen): # @retval list The token list of the dependency expression af= ter parsed # def _GetDepexExpressionTokenList(self): - if self._DepexExpressionList =3D=3D None: + if self._DepexExpressionList is None: self._DepexExpressionList =3D {} if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION= _FILE in self.FileTypes: return self._DepexExpressionList @@ -3298,7 +3298,7 @@ class ModuleAutoGen(AutoGen): # @retval dict The dict containing valid options # def _GetModuleBuildOption(self): - if self._BuildOption =3D=3D None: + if self._BuildOption is None: self._BuildOption, self.BuildRuleOrder =3D self.PlatformInfo.A= pplyBuildOption(self.Module) if self.BuildRuleOrder: self.BuildRuleOrder =3D ['.%s' % Ext for Ext in self.Build= RuleOrder.split()] @@ -3309,7 +3309,7 @@ class ModuleAutoGen(AutoGen): # @retval list The include path list # def _GetBuildOptionIncPathList(self): - if self._BuildOptionIncPathList =3D=3D None: + if self._BuildOptionIncPathList is None: # # Regular expression for finding Include Directories, the diff= erence between MSFT and INTEL/GCC/RVCT # is the former use /I , the Latter used -I to specify include= directories @@ -3370,7 +3370,7 @@ class ModuleAutoGen(AutoGen): # $(CONF_DIRECTORY)/build_rule.txt and toolchain family. # def _GetSourceFileList(self): - if self._SourceFileList =3D=3D None: + if self._SourceFileList is None: self._SourceFileList =3D [] for F in self.Module.Sources: # match tool chain @@ -3423,7 +3423,7 @@ class ModuleAutoGen(AutoGen): =20 ## Return the list of unicode files def _GetUnicodeFileList(self): - if self._UnicodeFileList =3D=3D None: + if self._UnicodeFileList is None: if TAB_UNICODE_FILE in self.FileTypes: self._UnicodeFileList =3D self.FileTypes[TAB_UNICODE_FILE] else: @@ -3432,7 +3432,7 @@ class ModuleAutoGen(AutoGen): =20 ## Return the list of vfr files def _GetVfrFileList(self): - if self._VfrFileList =3D=3D None: + if self._VfrFileList is None: if TAB_VFR_FILE in self.FileTypes: self._VfrFileList =3D self.FileTypes[TAB_VFR_FILE] else: @@ -3441,7 +3441,7 @@ class ModuleAutoGen(AutoGen): =20 ## Return the list of Image Definition files def _GetIdfFileList(self): - if self._IdfFileList =3D=3D None: + if self._IdfFileList is None: if TAB_IMAGE_FILE in self.FileTypes: self._IdfFileList =3D self.FileTypes[TAB_IMAGE_FILE] else: @@ -3455,7 +3455,7 @@ class ModuleAutoGen(AutoGen): # @retval list The list of files which can be built l= ater # def _GetBinaryFiles(self): - if self._BinaryFileList =3D=3D None: + if self._BinaryFileList is None: self._BinaryFileList =3D [] for F in self.Module.Binaries: if F.Target not in ['COMMON', '*'] and F.Target !=3D self.= BuildTarget: @@ -3465,7 +3465,7 @@ class ModuleAutoGen(AutoGen): return self._BinaryFileList =20 def _GetBuildRules(self): - if self._BuildRules =3D=3D None: + if self._BuildRules is None: BuildRules =3D {} BuildRuleDatabase =3D self.PlatformInfo.BuildRule for Type in BuildRuleDatabase.FileTypeList: @@ -3492,7 +3492,7 @@ class ModuleAutoGen(AutoGen): return self._BuildRules =20 def _ApplyBuildRule(self, File, FileType): - if self._BuildTargets =3D=3D None: + if self._BuildTargets is None: self._IntroBuildTargetList =3D set() self._FinalBuildTargetList =3D set() self._BuildTargets =3D {} @@ -3569,7 +3569,7 @@ class ModuleAutoGen(AutoGen): FileType =3D TAB_UNKNOWN_FILE =20 def _GetTargets(self): - if self._BuildTargets =3D=3D None: + if self._BuildTargets is None: self._IntroBuildTargetList =3D set() self._FinalBuildTargetList =3D set() self._BuildTargets =3D {} @@ -3616,7 +3616,7 @@ class ModuleAutoGen(AutoGen): if self.BuildType =3D=3D 'UEFI_HII': UniStringAutoGenC =3D False IdfStringAutoGenC =3D False - if self._AutoGenFileList =3D=3D None: + if self._AutoGenFileList is None: self._AutoGenFileList =3D {} AutoGenC =3D TemplateString() AutoGenH =3D TemplateString() @@ -3661,7 +3661,7 @@ class ModuleAutoGen(AutoGen): =20 ## Return the list of library modules explicitly or implicityly used b= y this module def _GetLibraryList(self): - if self._DependentLibraryList =3D=3D None: + if self._DependentLibraryList is None: # only merge library classes and PCD for non-library module if self.IsLibrary: self._DependentLibraryList =3D [] @@ -3683,7 +3683,7 @@ class ModuleAutoGen(AutoGen): # @retval list The list of PCD # def _GetModulePcdList(self): - if self._ModulePcdList =3D=3D None: + if self._ModulePcdList is None: # apply PCD settings from platform self._ModulePcdList =3D self.PlatformInfo.ApplyPcdSetting(self= .Module, self.Module.Pcds) self.UpdateComments(self._PcdComments, self.Module.PcdComments) @@ -3694,7 +3694,7 @@ class ModuleAutoGen(AutoGen): # @retval list The list of PCD # def _GetLibraryPcdList(self): - if self._LibraryPcdList =3D=3D None: + if self._LibraryPcdList is None: Pcds =3D sdict() if not self.IsLibrary: # get PCDs from dependent libraries @@ -3716,7 +3716,7 @@ class ModuleAutoGen(AutoGen): # @retval dict The mapping between GUID cname and its value # def _GetGuidList(self): - if self._GuidList =3D=3D None: + if self._GuidList is None: self._GuidList =3D sdict() self._GuidList.update(self.Module.Guids) for Library in self.DependentLibraryList: @@ -3726,7 +3726,7 @@ class ModuleAutoGen(AutoGen): return self._GuidList =20 def GetGuidsUsedByPcd(self): - if self._GuidsUsedByPcd =3D=3D None: + if self._GuidsUsedByPcd is None: self._GuidsUsedByPcd =3D sdict() self._GuidsUsedByPcd.update(self.Module.GetGuidsUsedByPcd()) for Library in self.DependentLibraryList: @@ -3737,7 +3737,7 @@ class ModuleAutoGen(AutoGen): # @retval dict The mapping between protocol cname and its val= ue # def _GetProtocolList(self): - if self._ProtocolList =3D=3D None: + if self._ProtocolList is None: self._ProtocolList =3D sdict() self._ProtocolList.update(self.Module.Protocols) for Library in self.DependentLibraryList: @@ -3751,7 +3751,7 @@ class ModuleAutoGen(AutoGen): # @retval dict The mapping between PPI cname and its value # def _GetPpiList(self): - if self._PpiList =3D=3D None: + if self._PpiList is None: self._PpiList =3D sdict() self._PpiList.update(self.Module.Ppis) for Library in self.DependentLibraryList: @@ -3765,7 +3765,7 @@ class ModuleAutoGen(AutoGen): # @retval list The list path # def _GetIncludePathList(self): - if self._IncludePathList =3D=3D None: + if self._IncludePathList is None: self._IncludePathList =3D [] if self.AutoGenVersion < 0x00010005: for Inc in self.Module.Includes: @@ -3957,7 +3957,7 @@ class ModuleAutoGen(AutoGen): return =20 # Skip the following code for modules with no source files - if self.SourceFileList =3D=3D None or self.SourceFileList =3D=3D [= ]: + if self.SourceFileList is None or self.SourceFileList =3D=3D []: return =20 # Skip the following code for modules without any binary files @@ -4172,7 +4172,7 @@ class ModuleAutoGen(AutoGen): HexFormat =3D '0x%016x' PcdValue =3D HexFormat % int(Pcd.DefaultValue, 0) else: - if Pcd.MaxDatumSize =3D=3D None or Pcd.MaxDatumSize = =3D=3D '': + if Pcd.MaxDatumSize is None or Pcd.MaxDatumSize =3D=3D= '': EdkLogger.error("build", AUTOGEN_ERROR, "Unknown [MaxDatumSize] of PCD [%s= .%s]" % (Pcd.TokenSpaceGuidCName, TokenCName) ) @@ -4452,7 +4452,7 @@ class ModuleAutoGen(AutoGen): =20 ## Summarize the ModuleAutoGen objects of all libraries used by this m= odule def _GetLibraryAutoGenList(self): - if self._LibraryAutoGenList =3D=3D None: + if self._LibraryAutoGenList is None: self._LibraryAutoGenList =3D [] for Library in self.DependentLibraryList: La =3D ModuleAutoGen( @@ -4540,7 +4540,7 @@ class ModuleAutoGen(AutoGen): return True =20 def GetTimeStampPath(self): - if self._TimeStampPath =3D=3D None: + if self._TimeStampPath is None: self._TimeStampPath =3D os.path.join(self.MakeFileDir, 'AutoGe= nTimeStamp') return self._TimeStampPath def CreateTimeStamp(self, Makefile): --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel