From nobody Mon May 6 11:02:01 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; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1526602019172515.0014190830425; Thu, 17 May 2018 17:06:59 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8ABC6208AE405; Thu, 17 May 2018 17:06:56 -0700 (PDT) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 727CD20837995 for ; Thu, 17 May 2018 17:06:55 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 May 2018 17:06:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 17 May 2018 17:06:54 -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=192.55.52.136; helo=mga12.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.49,413,1520924400"; d="scan'208";a="56905106" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Thu, 17 May 2018 17:06:51 -0700 Message-Id: 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: refactor to remove functions 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: , 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" refactoring almost identical functions to delete and use the other. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 165 ++-------------= ----- BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 52 ++++-- 2 files changed, 45 insertions(+), 172 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 1e6511cdb5d2..d1801bff9c83 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -42,6 +42,7 @@ from GenPatchPcdTable.GenPatchPcdTable import parsePcdInf= oFromMapFile import Common.VpdInfoFile as VpdInfoFile from GenPcdDb import CreatePcdDatabaseCode from Workspace.MetaFileCommentParser import UsageList +from Workspace.WorkspaceCommon import GetModuleLibInstances from Common.MultipleWorkspace import MultipleWorkspace as mws import InfSectionParser import datetime @@ -2156,162 +2157,14 @@ class PlatformAutoGen(AutoGen): if str(Module) not in self.Platform.Modules: return [] =20 - ModuleType =3D Module.ModuleType - - # for overridding library instances with module specific setting - PlatformModule =3D self.Platform.Modules[str(Module)] - - # add forced library instances (specified under LibraryClasses sec= tions) - # - # If a module has a MODULE_TYPE of USER_DEFINED, - # do not link in NULL library class instances from the global [Lib= raryClasses.*] sections. - # - if Module.ModuleType !=3D SUP_MODULE_USER_DEFINED: - for LibraryClass in self.Platform.LibraryClasses.GetKeys(): - if LibraryClass.startswith("NULL") and self.Platform.Libra= ryClasses[LibraryClass, Module.ModuleType]: - Module.LibraryClasses[LibraryClass] =3D self.Platform.= LibraryClasses[LibraryClass, Module.ModuleType] - - # add forced library instances (specified in module overrides) - for LibraryClass in PlatformModule.LibraryClasses: - if LibraryClass.startswith("NULL"): - Module.LibraryClasses[LibraryClass] =3D PlatformModule.Lib= raryClasses[LibraryClass] - - # EdkII module - LibraryConsumerList =3D [Module] - Constructor =3D [] - ConsumedByList =3D OrderedDict() - LibraryInstance =3D OrderedDict() - - EdkLogger.verbose("") - EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(= Module), self.Arch)) - while len(LibraryConsumerList) > 0: - M =3D LibraryConsumerList.pop() - for LibraryClassName in M.LibraryClasses: - if LibraryClassName not in LibraryInstance: - # override library instance for this module - if LibraryClassName in PlatformModule.LibraryClasses: - LibraryPath =3D PlatformModule.LibraryClasses[Libr= aryClassName] - else: - LibraryPath =3D self.Platform.LibraryClasses[Libra= ryClassName, ModuleType] - if LibraryPath is None or LibraryPath =3D=3D "": - LibraryPath =3D M.LibraryClasses[LibraryClassName] - 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, - ExtraData=3D"in [%s] [%s]\n\tc= onsumed by module [%s]" % (str(M), self.Arch, str(Module))) - - LibraryModule =3D self.BuildDatabase[LibraryPath, self= .Arch, self.BuildTarget, self.ToolChain] - # 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 is None \ - or len(LibraryModule.LibraryClass) =3D=3D 0 \ - or (ModuleType !=3D SUP_MODULE_USER_DEFINED - and ModuleType not in LibraryModule.LibraryCl= ass[0].SupModList): - # only USER_DEFINED can link against any library i= nstance despite of its SupModList - EdkLogger.error("build", OPTION_MISSING, - "Module type [%s] is not supported= by library instance [%s]" \ - % (ModuleType, LibraryPath), File= =3Dself.MetaFile, - ExtraData=3D"consumed by [%s]" % s= tr(Module)) - - LibraryInstance[LibraryClassName] =3D LibraryModule - LibraryConsumerList.append(LibraryModule) - EdkLogger.verbose("\t" + str(LibraryClassName) + " : "= + str(LibraryModule)) - else: - LibraryModule =3D LibraryInstance[LibraryClassName] - - if LibraryModule is None: - continue - - if LibraryModule.ConstructorList !=3D [] and LibraryModule= not in Constructor: - Constructor.append(LibraryModule) - - if LibraryModule not in ConsumedByList: - ConsumedByList[LibraryModule] =3D [] - # don't add current module itself to consumer list - if M !=3D Module: - if M in ConsumedByList[LibraryModule]: - continue - ConsumedByList[LibraryModule].append(M) - # - # Initialize the sorted output list to the empty set - # - SortedLibraryList =3D [] - # - # Q <- Set of all nodes with no incoming edges - # - LibraryList =3D [] #LibraryInstance.values() - Q =3D [] - for LibraryClassName in LibraryInstance: - M =3D LibraryInstance[LibraryClassName] - LibraryList.append(M) - if ConsumedByList[M] =3D=3D []: - Q.append(M) - - # - # start the DAG algorithm - # - while True: - EdgeRemoved =3D True - while Q =3D=3D [] and EdgeRemoved: - EdgeRemoved =3D False - # for each node Item with a Constructor - for Item in LibraryList: - if Item not in Constructor: - continue - # for each Node without a constructor with an edge e f= rom Item to Node - for Node in ConsumedByList[Item]: - if Node in Constructor: - continue - # remove edge e from the graph if Node has no cons= tructor - ConsumedByList[Item].remove(Node) - EdgeRemoved =3D True - if ConsumedByList[Item] =3D=3D []: - # insert Item into Q - Q.insert(0, Item) - break - if Q !=3D []: - break - # DAG is done if there's no more incoming edge for all nodes - if Q =3D=3D []: - break - - # remove node from Q - Node =3D Q.pop() - # output Node - SortedLibraryList.append(Node) - - # for each node Item with an edge e from Node to Item do - for Item in LibraryList: - if Node not in ConsumedByList[Item]: - continue - # remove edge e from the graph - ConsumedByList[Item].remove(Node) - - if ConsumedByList[Item] !=3D []: - continue - # insert Item into Q, if Item has no other incoming edges - Q.insert(0, Item) - - # - # if any remaining node Item in the graph has a constructor and an= incoming edge, then the graph has a cycle - # - for Item in LibraryList: - if ConsumedByList[Item] !=3D [] and Item in Constructor and le= n(Constructor) > 1: - ErrorMessage =3D "\tconsumed by " + "\n\tconsumed by ".joi= n(str(L) for L in ConsumedByList[Item]) - EdkLogger.error("build", BUILD_ERROR, 'Library [%s] with c= onstructors has a cycle' % str(Item), - ExtraData=3DErrorMessage, File=3Dself.Meta= File) - if Item not in SortedLibraryList: - SortedLibraryList.append(Item) - - # - # Build the list of constructor and destructir names - # The DAG Topo sort produces the destructor order, so the list of = constructors must generated in the reverse order - # - SortedLibraryList.reverse() - return SortedLibraryList - + return GetModuleLibInstances(Module, + self.Platform, + self.BuildDatabase, + self.Arch, + self.BuildTarget, + self.ToolChain, + self.MetaFile, + EdkLogger) =20 ## Override PCD setting (type, value, ...) # diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseToo= ls/Source/Python/Workspace/WorkspaceCommon.py index 573100081815..a28fbdf03021 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -83,16 +83,13 @@ def GetDeclaredPcd(Platform, BuildDatabase, Arch, Targe= t, Toolchain,additionalPk # def GetLiabraryInstances(Module, Platform, BuildDatabase, Arch, Target, To= olchain): if Module.AutoGenVersion >=3D 0x00010005: - return _GetModuleLibraryInstances(Module, Platform, BuildDatabase,= Arch, Target, Toolchain) + return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch= , Target, Toolchain) else: return _ResolveLibraryReference(Module, Platform) =20 -def _GetModuleLibraryInstances(Module, Platform, BuildDatabase, Arch, Targ= et, Toolchain): +def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, T= oolchain, FileName =3D '', EdkLogger =3D None): ModuleType =3D Module.ModuleType =20 - # for overriding library instances with module specific setting - PlatformModule =3D Platform.Modules[str(Module)] - # add forced library instances (specified under LibraryClasses section= s) # # If a module has a MODULE_TYPE of USER_DEFINED, @@ -104,9 +101,9 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To Module.LibraryClasses[LibraryClass] =3D Platform.LibraryCl= asses[LibraryClass, Module.ModuleType] =20 # add forced library instances (specified in module overrides) - for LibraryClass in PlatformModule.LibraryClasses: + for LibraryClass in Platform.Modules[str(Module)].LibraryClasses: if LibraryClass.startswith("NULL"): - Module.LibraryClasses[LibraryClass] =3D PlatformModule.Library= Classes[LibraryClass] + Module.LibraryClasses[LibraryClass] =3D Platform.Modules[str(M= odule)].LibraryClasses[LibraryClass] =20 # EdkII module LibraryConsumerList =3D [Module] @@ -114,19 +111,29 @@ def _GetModuleLibraryInstances(Module, Platform, Buil= dDatabase, Arch, Target, To ConsumedByList =3D OrderedListDict() LibraryInstance =3D OrderedDict() =20 + if FileName: + EdkLogger.verbose("") + EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(= Module), Arch)) + while len(LibraryConsumerList) > 0: M =3D LibraryConsumerList.pop() for LibraryClassName in M.LibraryClasses: if LibraryClassName not in LibraryInstance: # override library instance for this module - if LibraryClassName in PlatformModule.LibraryClasses: - LibraryPath =3D PlatformModule.LibraryClasses[LibraryC= lassName] + if LibraryClassName in Platform.Modules[str(Module)].Libra= ryClasses: + LibraryPath =3D Platform.Modules[str(Module)].LibraryC= lasses[LibraryClassName] else: LibraryPath =3D Platform.LibraryClasses[LibraryClassNa= me, ModuleType] if LibraryPath is None or LibraryPath =3D=3D "": LibraryPath =3D M.LibraryClasses[LibraryClassName] if LibraryPath is None or LibraryPath =3D=3D "": - return [] + if FileName: + EdkLogger.error("build", RESOURCE_NOT_AVAILABL= E, + "Instance of library class [%s= ] is not found" % LibraryClassName, + File=3DFileName, + ExtraData=3D"in [%s] [%s]\n\tc= onsumed by module [%s]" % (str(M), Arch, str(Module))) + else: + return [] =20 LibraryModule =3D BuildDatabase[LibraryPath, Arch, Target,= Toolchain] # for those forced library instance (NULL library), add a = fake library class @@ -137,10 +144,18 @@ def _GetModuleLibraryInstances(Module, Platform, Buil= dDatabase, Arch, Target, To or (ModuleType !=3D SUP_MODULE_USER_DEFINED and ModuleType not in LibraryModule.LibraryClass[= 0].SupModList): # only USER_DEFINED can link against any library insta= nce despite of its SupModList - return [] + if FileName: + EdkLogger.error("build", OPTION_MISSING, + "Module type [%s] is not supported= by library instance [%s]" \ + % (ModuleType, LibraryPath), File= =3DFileName, + ExtraData=3D"consumed by [%s]" % s= tr(Module)) + else: + return [] =20 LibraryInstance[LibraryClassName] =3D LibraryModule LibraryConsumerList.append(LibraryModule) + if FileName: + EdkLogger.verbose("\t" + str(LibraryClassName) + " : "= + str(LibraryModule)) else: LibraryModule =3D LibraryInstance[LibraryClassName] =20 @@ -167,7 +182,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To for LibraryClassName in LibraryInstance: M =3D LibraryInstance[LibraryClassName] LibraryList.append(M) - if len(ConsumedByList[M]) =3D=3D 0: + if not ConsumedByList[M]: Q.append(M) =20 # @@ -188,7 +203,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To # remove edge e from the graph if Node has no construc= tor ConsumedByList[Item].remove(Node) EdgeRemoved =3D True - if len(ConsumedByList[Item]) =3D=3D 0: + if not ConsumedByList[Item]: # insert Item into Q Q.insert(0, Item) break @@ -210,7 +225,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To # remove edge e from the graph ConsumedByList[Item].remove(Node) =20 - if len(ConsumedByList[Item]) !=3D 0: + if ConsumedByList[Item]: continue # insert Item into Q, if Item has no other incoming edges Q.insert(0, Item) @@ -219,8 +234,13 @@ def _GetModuleLibraryInstances(Module, Platform, Build= Database, Arch, Target, To # if any remaining node Item in the graph has a constructor and an inc= oming edge, then the graph has a cycle # for Item in LibraryList: - if len(ConsumedByList[Item]) !=3D 0 and Item in Constructor and le= n(Constructor) > 1: - return [] + if ConsumedByList[Item] and Item in Constructor and len(Constructo= r) > 1: + if FileName: + ErrorMessage =3D "\tconsumed by " + "\n\tconsumed by ".joi= n(str(L) for L in ConsumedByList[Item]) + EdkLogger.error("build", BUILD_ERROR, 'Library [%s] with c= onstructors has a cycle' % str(Item), + ExtraData=3DErrorMessage, File=3DFileName) + else: + return [] if Item not in SortedLibraryList: SortedLibraryList.append(Item) =20 --=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 May 6 11:02:01 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; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1526602021897675.3935947824062; Thu, 17 May 2018 17:07:01 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B4198208AE88E; Thu, 17 May 2018 17:06:57 -0700 (PDT) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 A22D6207E637F for ; Thu, 17 May 2018 17:06:55 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 May 2018 17:06:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 17 May 2018 17:06:54 -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=192.55.52.136; helo=mga12.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.49,413,1520924400"; d="scan'208";a="56905109" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Thu, 17 May 2018 17:06:52 -0700 Message-Id: <659ea4a0cdeebe126604a1ee4fe4226770d03183.1526601941.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: Cleanup unneeded code 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: , 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" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 335 +++++++++----= ------- BaseTools/Source/Python/AutoGen/GenC.py | 2 +- BaseTools/Source/Python/AutoGen/GenMake.py | 4 +- BaseTools/Source/Python/AutoGen/GenPcdDb.py | 14 +- BaseTools/Source/Python/AutoGen/GenVar.py | 2 +- BaseTools/Source/Python/AutoGen/StrGather.py | 8 +- BaseTools/Source/Python/Common/Misc.py | 2 +- BaseTools/Source/Python/Common/String.py | 2 +- BaseTools/Source/Python/Common/VpdInfoFile.py | 2 +- BaseTools/Source/Python/GenFds/FdfParser.py | 8 +- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 119 ++++--- BaseTools/Source/Python/build/BuildReport.py | 26 +- BaseTools/Source/Python/build/build.py | 6 +- 13 files changed, 246 insertions(+), 284 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index d1801bff9c83..a0f57903a40e 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -50,6 +50,7 @@ import hashlib from GenVar import VariableMgr,var_info from collections import OrderedDict from collections import defaultdict +from Workspace.WorkspaceCommon import OrderedListDict =20 ## Regular expression for splitting Dependency Expression string into toke= ns gDepexTokenPattern =3D re.compile("(\(|\)|\w+| \S+\.inf)") @@ -463,7 +464,7 @@ class WorkspaceAutoGen(AutoGen): 'build', FORMAT_INVALID, "Building modules from source INFs, following = PCD use %s and %s access method. It must be corrected to use only one acces= s method." % (i, j), - ExtraData=3D"%s" % '\n\t'.join(str(P[1]+'.'+P[= 0]) for P in Intersections) + ExtraData=3D'\n\t'.join(str(P[1]+'.'+P[0]) for= P in Intersections) ) =20 # @@ -705,10 +706,9 @@ class WorkspaceAutoGen(AutoGen): # if self.FdfFile: AllWorkSpaceMetaFiles.add (self.FdfFile.Path) - if self.FdfFile: - FdfFiles =3D GlobalData.gFdfParser.GetAllIncludedFile() - for f in FdfFiles: - AllWorkSpaceMetaFiles.add (f.FileName) + for f in GlobalData.gFdfParser.GetAllIncludedFile(): + AllWorkSpaceMetaFiles.add (f.FileName) + # # add dsc # @@ -729,19 +729,16 @@ class WorkspaceAutoGen(AutoGen): AllWorkSpaceMetaFiles.add(os.path.join(self.BuildDir, 'PcdTokenNum= ber')) =20 for Arch in self.ArchList: - Platform =3D self.BuildDatabase[self.MetaFile, Arch, Target, T= oolchain] - PGen =3D PlatformAutoGen(self, self.MetaFile, Target, Toolchai= n, Arch) - # # add dec # - for Package in PGen.PackageList: + for Package in PlatformAutoGen(self, self.MetaFile, Target, To= olchain, Arch).PackageList: AllWorkSpaceMetaFiles.add(Package.MetaFile.Path) =20 # # add included dsc # - for filePath in Platform._RawData.IncludedFiles: + for filePath in self.BuildDatabase[self.MetaFile, Arch, Target= , Toolchain]._RawData.IncludedFiles: AllWorkSpaceMetaFiles.add(filePath.Path) =20 return AllWorkSpaceMetaFiles @@ -872,12 +869,11 @@ class WorkspaceAutoGen(AutoGen): =20 =20 def _CheckPcdDefineAndType(self): - PcdTypeList =3D [ - TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCD= S_FEATURE_FLAG, - TAB_PCDS_DYNAMIC, #TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_VPD, - TAB_PCDS_DYNAMIC_EX, # TAB_PCDS_DYNAMIC_EX_HII, TAB_PCDS_DYNAM= IC_EX_VPD - ] - + PcdTypeSet =3D {TAB_PCDS_FIXED_AT_BUILD, + TAB_PCDS_PATCHABLE_IN_MODULE, + TAB_PCDS_FEATURE_FLAG, + TAB_PCDS_DYNAMIC, + TAB_PCDS_DYNAMIC_EX} # This dict store PCDs which are not used by any modules with spec= ified arches UnusedPcd =3D OrderedDict() for Pa in self.AutoGenObjectList: @@ -899,7 +895,7 @@ class WorkspaceAutoGen(AutoGen): # Key of DEC's Pcds dictionary is PcdCName, TokenSpace= Guid, PcdType if (Pcd[0], Pcd[1], PcdType) in Package.Pcds: break - for Type in PcdTypeList: + for Type in PcdTypeSet: if (Pcd[0], Pcd[1], Type) in Package.Pcds: EdkLogger.error( 'build', @@ -1057,9 +1053,10 @@ class WorkspaceAutoGen(AutoGen): # modules will be created as well # def CreateMakeFile(self, CreateDepsMakeFile=3DFalse): - if CreateDepsMakeFile: - for Pa in self.AutoGenObjectList: - Pa.CreateMakeFile(CreateDepsMakeFile) + if not CreateDepsMakeFile: + return + for Pa in self.AutoGenObjectList: + Pa.CreateMakeFile(True) =20 ## Create autogen code for platform and modules # @@ -1073,7 +1070,7 @@ class WorkspaceAutoGen(AutoGen): if not CreateDepsCodeFile: return for Pa in self.AutoGenObjectList: - Pa.CreateCodeFile(CreateDepsCodeFile) + Pa.CreateCodeFile(True) =20 ## Create AsBuilt INF file the platform # @@ -1378,11 +1375,7 @@ class PlatformAutoGen(AutoGen): del self.Platform.Pcds[key] self.Platform.Pcds[newkey] =3D Value break - else: - pass break - else: - pass =20 # for gathering error information NoDatumTypePcdList =3D set() @@ -1567,8 +1560,7 @@ class PlatformAutoGen(AutoGen): PcdNvStoreDfBuffer.SkuInfoList[skuname].DefaultVal= ue =3D vardump PcdNvStoreDfBuffer.MaxDatumSize =3D str(len(vardum= p.split(","))) =20 - PlatformPcds =3D self._PlatformPcds.keys() - PlatformPcds.sort() + PlatformPcds =3D sorted(self._PlatformPcds.keys()) # # Add VPD type PCD into VpdFile and determine whether the VPD = PCD need to be fixed up. # @@ -1874,7 +1866,7 @@ class PlatformAutoGen(AutoGen): if Flags.startswith('=3D'): self._BuildCommand =3D [self._BuildCommand[0]]= + [Flags[1:]] else: - self._BuildCommand +=3D [Flags] + self._BuildCommand.append(Flags) return self._BuildCommand =20 ## Get tool chain definition @@ -2069,32 +2061,28 @@ class PlatformAutoGen(AutoGen): # TokeNumber 11 ~ 20 # for Pcd in self.DynamicPcdList: - if Pcd.Phase =3D=3D "PEI": - if Pcd.Type in PCD_DYNAMIC_TYPE_SET: - EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) - self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber - TokenNumber +=3D 1 + if Pcd.Phase =3D=3D "PEI" and Pcd.Type in PCD_DYNAMIC_TYPE= _SET: + EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" = % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) + self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGui= dCName] =3D TokenNumber + TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: - if Pcd.Phase =3D=3D "PEI": - if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: - EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) - self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber - TokenNumber +=3D 1 + if Pcd.Phase =3D=3D "PEI" and Pcd.Type in PCD_DYNAMIC_EX_T= YPE_SET: + EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" = % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) + self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGui= dCName] =3D TokenNumber + TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: - if Pcd.Phase =3D=3D "DXE": - if Pcd.Type in PCD_DYNAMIC_TYPE_SET: - EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) - self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber - TokenNumber +=3D 1 + if Pcd.Phase =3D=3D "DXE" and Pcd.Type in PCD_DYNAMIC_TYPE= _SET: + EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" = % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) + self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGui= dCName] =3D TokenNumber + TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: - if Pcd.Phase =3D=3D "DXE": - if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: - EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) - self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber - TokenNumber +=3D 1 + if Pcd.Phase =3D=3D "DXE" and Pcd.Type in PCD_DYNAMIC_EX_T= YPE_SET: + EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" = % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) + self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGui= dCName] =3D TokenNumber + TokenNumber +=3D 1 =20 for Pcd in self.NonDynamicPcdList: self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCNa= me] =3D TokenNumber @@ -2185,8 +2173,8 @@ class PlatformAutoGen(AutoGen): if FromPcd is not None: if ToPcd.Pending and FromPcd.Type: ToPcd.Type =3D FromPcd.Type - elif (ToPcd.Type) and (FromPcd.Type)\ - and (ToPcd.Type !=3D FromPcd.Type) and (ToPcd.Type in From= Pcd.Type): + elif ToPcd.Type and FromPcd.Type\ + and ToPcd.Type !=3D FromPcd.Type and ToPcd.Type in FromPcd= .Type: if ToPcd.Type.strip() =3D=3D TAB_PCDS_DYNAMIC_EX: ToPcd.Type =3D FromPcd.Type elif ToPcd.Type and FromPcd.Type \ @@ -2397,13 +2385,14 @@ class PlatformAutoGen(AutoGen): if (Key[0] =3D=3D self.BuildRuleFamily and (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= "*": - if Arch =3D=3D self.Arch or Arch =3D=3D "*": - if Options[Key].startswith("=3D"): - if OverrideList.get(Key[1]) is not None: - OverrideList.pop(Key[1]) - OverrideList[Key[1]] =3D Options[Key] + if (Target =3D=3D self.BuildTarget or Target =3D=3D "*") a= nd\ + (ToolChain =3D=3D self.ToolChain or ToolChain =3D=3D "= *") and\ + (Arch =3D=3D self.Arch or Arch =3D=3D "*") and\ + Options[Key].startswith("=3D"): + + if OverrideList.get(Key[1]) is not None: + OverrideList.pop(Key[1]) + OverrideList[Key[1]] =3D Options[Key] =20 # # Use the highest priority value.=20 @@ -2419,17 +2408,18 @@ class PlatformAutoGen(AutoGen): # Compare two Key, if one is included by another, choo= se the higher priority one # =20 Target2, ToolChain2, Arch2, CommandType2, Attr2 =3D Ne= xtKey.split("_") - if Target1 =3D=3D Target2 or Target1 =3D=3D "*" or Tar= get2 =3D=3D "*": - if ToolChain1 =3D=3D ToolChain2 or ToolChain1 =3D= =3D "*" or ToolChain2 =3D=3D "*": - if Arch1 =3D=3D Arch2 or Arch1 =3D=3D "*" or A= rch2 =3D=3D "*": - if CommandType1 =3D=3D CommandType2 or Com= mandType1 =3D=3D "*" or CommandType2 =3D=3D "*": - if Attr1 =3D=3D Attr2 or Attr1 =3D=3D = "*" or Attr2 =3D=3D "*": - if self.CalculatePriorityValue(Now= Key) > self.CalculatePriorityValue(NextKey): - if Options.get((self.BuildRule= Family, NextKey)) is not None: - Options.pop((self.BuildRul= eFamily, NextKey)) - else: - if Options.get((self.BuildRule= Family, NowKey)) is not None: - Options.pop((self.BuildRul= eFamily, NowKey)) + if (Target1 =3D=3D Target2 or Target1 =3D=3D "*" or Ta= rget2 =3D=3D "*") and\ + (ToolChain1 =3D=3D ToolChain2 or ToolChain1 =3D=3D= "*" or ToolChain2 =3D=3D "*") and\ + (Arch1 =3D=3D Arch2 or Arch1 =3D=3D "*" or Arch2 = =3D=3D "*") and\ + (CommandType1 =3D=3D CommandType2 or CommandType1 = =3D=3D "*" or CommandType2 =3D=3D "*") and\ + (Attr1 =3D=3D Attr2 or Attr1 =3D=3D "*" or Attr2 = =3D=3D "*"): + + if self.CalculatePriorityValue(NowKey) > self.Calc= ulatePriorityValue(NextKey): + if Options.get((self.BuildRuleFamily, NextKey)= ) is not None: + Options.pop((self.BuildRuleFamily, NextKey= )) + else: + if Options.get((self.BuildRuleFamily, NowKey))= is not None: + Options.pop((self.BuildRuleFamily, NowKey)) =20 for Key in Options: if ModuleStyle is not None and len (Key) > 2: @@ -2591,6 +2581,14 @@ class PlatformAutoGen(AutoGen): LibraryAutoGenList =3D property(_GetLibraryAutoGenList) GenFdsCommand =3D property(_GenFdsCommand) =20 +# +# extend lists contained in a dictionary with lists stored in another dict= ionary +# if CopyToDict is not derived from DefaultDict(list) then this may raise = exception +# +def ExtendCopyDictionaryLists(CopyToDict, CopyFromDict): + for Key in CopyFromDict: + CopyToDict[Key].extend(CopyFromDict[Key]) + ## ModuleAutoGen class # # This class encapsules the AutoGen behaviors for the build tools. In addi= tion to @@ -2681,7 +2679,6 @@ class ModuleAutoGen(AutoGen): self._MakeFileDir =3D None =20 self._IncludePathList =3D None - self._IncludePathLength =3D 0 self._AutoGenFileList =3D None self._UnicodeFileList =3D None self._VfrFileList =3D None @@ -2696,16 +2693,16 @@ class ModuleAutoGen(AutoGen): self._DerivedPackageList =3D None self._ModulePcdList =3D None self._LibraryPcdList =3D None - self._PcdComments =3D OrderedDict() + self._PcdComments =3D OrderedListDict() self._GuidList =3D None self._GuidsUsedByPcd =3D None - self._GuidComments =3D OrderedDict() + self._GuidComments =3D OrderedListDict() self._ProtocolList =3D None - self._ProtocolComments =3D OrderedDict() + self._ProtocolComments =3D OrderedListDict() self._PpiList =3D None - self._PpiComments =3D OrderedDict() - self._DepexList =3D None - self._DepexExpressionList =3D None + self._PpiComments =3D OrderedListDict() + self._DepexDict =3D None + self._DepexExpressionDict =3D None self._BuildOption =3D None self._BuildOptionIncPathList =3D None self._BuildTargets =3D None @@ -2727,7 +2724,6 @@ class ModuleAutoGen(AutoGen): # =20 self._FixedAtBuildPcds =3D [] self.ConstPcd =3D {} - return True =20 def __repr__(self): return "%s [%s]" % (self.MetaFile, self.Arch) @@ -2855,10 +2851,7 @@ class ModuleAutoGen(AutoGen): ## Check if the module is library or not def _IsLibrary(self): if self._LibraryFlag is None: - if self.Module.LibraryClass is not None and self.Module.Librar= yClass !=3D []: - self._LibraryFlag =3D True - else: - self._LibraryFlag =3D False + self._LibraryFlag =3D True if self.Module.LibraryClass else Fa= lse return self._LibraryFlag =20 ## Check if the module is binary module or not @@ -3010,15 +3003,15 @@ class ModuleAutoGen(AutoGen): # @retval list The token list of the dependency expression af= ter parsed # def _GetDepexTokenList(self): - if self._DepexList is None: - self._DepexList =3D {} + if self._DepexDict is None: + self._DepexDict =3D {} if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION= _FILE in self.FileTypes: - return self._DepexList + return self._DepexDict =20 - self._DepexList[self.ModuleType] =3D [] + self._DepexDict[self.ModuleType] =3D [] =20 - for ModuleType in self._DepexList: - DepexList =3D self._DepexList[ModuleType] + for ModuleType in self._DepexDict: + DepexList =3D self._DepexDict[ModuleType] # # Append depex from dependent libraries, if not "BEFORE", = "AFTER" expresion # @@ -3039,43 +3032,43 @@ class ModuleAutoGen(AutoGen): break if len(DepexList) > 0: EdkLogger.verbose('') - return self._DepexList + return self._DepexDict =20 ## Merge dependency expression # # @retval list The token list of the dependency expression af= ter parsed # def _GetDepexExpressionTokenList(self): - if self._DepexExpressionList is None: - self._DepexExpressionList =3D {} + if self._DepexExpressionDict is None: + self._DepexExpressionDict =3D {} if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION= _FILE in self.FileTypes: - return self._DepexExpressionList + return self._DepexExpressionDict =20 - self._DepexExpressionList[self.ModuleType] =3D '' + self._DepexExpressionDict[self.ModuleType] =3D '' =20 - for ModuleType in self._DepexExpressionList: - DepexExpressionList =3D self._DepexExpressionList[ModuleTy= pe] + for ModuleType in self._DepexExpressionDict: + DepexExpressionString =3D self._DepexExpressionDict[Module= Type] # # Append depex from dependent libraries, if not "BEFORE", = "AFTER" expresion # for M in [self.Module] + self.DependentLibraryList: Inherited =3D False for D in M.DepexExpression[self.Arch, ModuleType]: - if DepexExpressionList !=3D '': - DepexExpressionList +=3D ' AND ' - DepexExpressionList +=3D '(' - DepexExpressionList +=3D D - DepexExpressionList =3D DepexExpressionList.rstrip= ('END').strip() - DepexExpressionList +=3D ')' + if DepexExpressionString !=3D '': + DepexExpressionString +=3D ' AND ' + DepexExpressionString +=3D '(' + DepexExpressionString +=3D D + DepexExpressionString =3D DepexExpressionString.rs= trip('END').strip() + DepexExpressionString +=3D ')' Inherited =3D True if Inherited: - EdkLogger.verbose("DEPEX[%s] (+%s) =3D %s" % (self= .Name, M.BaseName, DepexExpressionList)) - if 'BEFORE' in DepexExpressionList or 'AFTER' in Depex= ExpressionList: + EdkLogger.verbose("DEPEX[%s] (+%s) =3D %s" % (self= .Name, M.BaseName, DepexExpressionString)) + if 'BEFORE' in DepexExpressionString or 'AFTER' in Dep= exExpressionString: break - if len(DepexExpressionList) > 0: + if len(DepexExpressionString) > 0: EdkLogger.verbose('') - self._DepexExpressionList[ModuleType] =3D DepexExpressionL= ist - return self._DepexExpressionList + self._DepexExpressionDict[ModuleType] =3D DepexExpressionS= tring + return self._DepexExpressionDict =20 # Get the tiano core user extension, it is contain dependent library. # @retval: a list contain tiano core userextension. @@ -3143,9 +3136,8 @@ class ModuleAutoGen(AutoGen): =20 BuildOptionIncPathList =3D [] for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'AS= M'): - Attr =3D 'FLAGS' try: - FlagOption =3D self.BuildOption[Tool][Attr] + FlagOption =3D self.BuildOption[Tool]['FLAGS'] except KeyError: FlagOption =3D '' =20 @@ -3158,13 +3150,13 @@ class ModuleAutoGen(AutoGen): IncPathList =3D [] for Path in BuildOptIncludeRegEx.findall(FlagOption): PathList =3D GetSplitList(Path, TAB_COMMA_SPLIT) - IncPathList +=3D [NormPath(PathEntry, self.Macros)= for PathEntry in PathList] + IncPathList.extend(NormPath(PathEntry, self.Macros= ) for PathEntry in PathList) =20 # # EDK II modules must not reference header files outside o= f the packages they depend on or=20 # within the module's directory tree. Report error if viol= ation. # - if self.AutoGenVersion >=3D 0x00010005 and len(IncPathList= ) > 0: + if self.AutoGenVersion >=3D 0x00010005: for Path in IncPathList: if (Path not in self.IncludePathList) and (CommonP= ath([Path, self.MetaFile.Dir]) !=3D self.MetaFile.Dir): ErrMsg =3D "The include directory for the EDK = II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, T= ool, FlagOption) @@ -3318,7 +3310,7 @@ class ModuleAutoGen(AutoGen): if not os.path.exists(SubDirectory): CreateDirectory(SubDirectory) LastTarget =3D None - RuleChain =3D [] + RuleChain =3D set() SourceList =3D [File] Index =3D 0 # @@ -3375,7 +3367,7 @@ class ModuleAutoGen(AutoGen): if FileType in RuleChain: break =20 - RuleChain.append(FileType) + RuleChain.add(FileType) SourceList.extend(Target.Outputs) LastTarget =3D Target FileType =3D TAB_UNKNOWN_FILE @@ -3484,12 +3476,6 @@ class ModuleAutoGen(AutoGen): self._DependentLibraryList =3D self.PlatformInfo.Apply= LibraryInstance(self.Module) return self._DependentLibraryList =20 - @staticmethod - def UpdateComments(Recver, Src): - for Key in Src: - if Key not in Recver: - Recver[Key] =3D [] - Recver[Key].extend(Src[Key]) ## Get the list of PCDs from current module # # @retval list The list of PCD @@ -3498,7 +3484,7 @@ class ModuleAutoGen(AutoGen): 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) + ExtendCopyDictionaryLists(self._PcdComments, self.Module.PcdCo= mments) return self._ModulePcdList =20 ## Get the list of PCDs from dependent libraries @@ -3511,7 +3497,7 @@ class ModuleAutoGen(AutoGen): if not self.IsLibrary: # get PCDs from dependent libraries for Library in self.DependentLibraryList: - self.UpdateComments(self._PcdComments, Library.PcdComm= ents) + ExtendCopyDictionaryLists(self._PcdComments, Library.P= cdComments) for Key in Library.Pcds: # skip duplicated PCDs if Key in self.Module.Pcds or Key in Pcds: @@ -3533,8 +3519,8 @@ class ModuleAutoGen(AutoGen): self._GuidList.update(self.Module.Guids) for Library in self.DependentLibraryList: self._GuidList.update(Library.Guids) - self.UpdateComments(self._GuidComments, Library.GuidCommen= ts) - self.UpdateComments(self._GuidComments, self.Module.GuidCommen= ts) + ExtendCopyDictionaryLists(self._GuidComments, Library.Guid= Comments) + ExtendCopyDictionaryLists(self._GuidComments, self.Module.Guid= Comments) return self._GuidList =20 def GetGuidsUsedByPcd(self): @@ -3554,8 +3540,8 @@ class ModuleAutoGen(AutoGen): self._ProtocolList.update(self.Module.Protocols) for Library in self.DependentLibraryList: self._ProtocolList.update(Library.Protocols) - self.UpdateComments(self._ProtocolComments, Library.Protoc= olComments) - self.UpdateComments(self._ProtocolComments, self.Module.Protoc= olComments) + ExtendCopyDictionaryLists(self._ProtocolComments, Library.= ProtocolComments) + ExtendCopyDictionaryLists(self._ProtocolComments, self.Module.= ProtocolComments) return self._ProtocolList =20 ## Get the PPI value mapping @@ -3568,8 +3554,8 @@ class ModuleAutoGen(AutoGen): self._PpiList.update(self.Module.Ppis) for Library in self.DependentLibraryList: self._PpiList.update(Library.Ppis) - self.UpdateComments(self._PpiComments, Library.PpiComments) - self.UpdateComments(self._PpiComments, self.Module.PpiComments) + ExtendCopyDictionaryLists(self._PpiComments, Library.PpiCo= mments) + ExtendCopyDictionaryLists(self._PpiComments, self.Module.PpiCo= mments) return self._PpiList =20 ## Get the list of include search path @@ -3607,11 +3593,7 @@ class ModuleAutoGen(AutoGen): return self._IncludePathList =20 def _GetIncludePathLength(self): - self._IncludePathLength =3D 0 - if self._IncludePathList: - for inc in self._IncludePathList: - self._IncludePathLength +=3D len(' ' + inc) - return self._IncludePathLength + return sum(len(inc)+1 for inc in self._IncludePathList) =20 ## Get HII EX PCDs which maybe used by VFR # @@ -3665,12 +3647,11 @@ class ModuleAutoGen(AutoGen): for Pcd in self.PlatformInfo.Platform.Pcds.values(): if Pcd.Type !=3D TAB_PCDS_DYNAMIC_EX_HII: continue - for SkuName in Pcd.SkuInfoList: - SkuInfo =3D Pcd.SkuInfoList[SkuName] - Name =3D ConvertStringToByteArray(SkuInfo.VariableName) + for SkuInfo in Pcd.SkuInfoList.values(): Value =3D GuidValue(SkuInfo.VariableGuid, self.PlatformInf= o.PackageList, self.MetaFile.Path) if not Value: continue + Name =3D ConvertStringToByteArray(SkuInfo.VariableName) Guid =3D GuidStructureStringToGuidString(Value) if (Name, Guid) in NameGuids and Pcd not in HiiExPcds: HiiExPcds.append(Pcd) @@ -3686,13 +3667,13 @@ class ModuleAutoGen(AutoGen): # search the .map file to find the offset of vfr binary in= the PE32+/TE file.=20 # VfrUniBaseName[SourceFile.BaseName] =3D (SourceFile.BaseNa= me + "Bin") - if SourceFile.Type.upper() =3D=3D ".UNI" : + elif SourceFile.Type.upper() =3D=3D ".UNI" : # # search the .map file to find the offset of Uni strings b= inary in the PE32+/TE file.=20 # VfrUniBaseName["UniOffsetName"] =3D (self.Name + "Strings") =20 - if len(VfrUniBaseName) =3D=3D 0: + if not VfrUniBaseName: return None MapFileName =3D os.path.join(self.OutputDir, self.Name + ".map") EfiFileName =3D os.path.join(self.OutputDir, self.Name + ".efi") @@ -3751,10 +3732,9 @@ class ModuleAutoGen(AutoGen): # def CreateAsBuiltInf(self, IsOnlyCopy =3D False): self.OutputFile =3D set() - if IsOnlyCopy: - if GlobalData.gBinCacheDest: - self.CopyModuleToCache() - return + if IsOnlyCopy and GlobalData.gBinCacheDest: + self.CopyModuleToCache() + return =20 if self.IsAsBuiltInfCreated: return @@ -3786,11 +3766,11 @@ class ModuleAutoGen(AutoGen): PcdTokenSpaceList =3D [] for Pcd in self.ModulePcdList + self.LibraryPcdList: if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE: - PatchablePcds +=3D [Pcd] + PatchablePcds.append(Pcd) PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCNa= me, TAB_PCDS_PATCHABLE_IN_MODULE)) elif Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: if Pcd not in Pcds: - Pcds +=3D [Pcd] + Pcds.append(Pcd) PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, TAB_PCDS_DYNAMIC_EX)) PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, TAB_PCDS_DYNAMIC)) PcdTokenSpaceList.append(Pcd.TokenSpaceGuidCName) @@ -3810,10 +3790,11 @@ class ModuleAutoGen(AutoGen): for Index in range(len(BeChecked)): for Item in CheckList[Index]: if Item in BeChecked[Index]: - Packages +=3D [Package] + Packages.append(Package) Found =3D True break - if Found: break + if Found: + break =20 VfrPcds =3D self._GetPcdsMaybeUsedByVfr() for Pkg in self.PlatformInfo.PackageList: @@ -3822,17 +3803,11 @@ class ModuleAutoGen(AutoGen): for VfrPcd in VfrPcds: if ((VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PC= DS_DYNAMIC_EX) in Pkg.Pcds or (VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PC= DS_DYNAMIC) in Pkg.Pcds): - Packages +=3D [Pkg] + Packages.append(Pkg) break =20 - ModuleType =3D self.ModuleType - if ModuleType =3D=3D SUP_MODULE_UEFI_DRIVER and self.DepexGenerate= d: - ModuleType =3D SUP_MODULE_DXE_DRIVER - - DriverType =3D '' - if self.PcdIsDriver !=3D '': - DriverType =3D self.PcdIsDriver - + ModuleType =3D SUP_MODULE_DXE_DRIVER if self.ModuleType =3D=3D SUP= _MODULE_UEFI_DRIVER and self.DepexGenerated else self.ModuleType + DriverType =3D self.PcdIsDriver if self.PcdIsDriver else '' Guid =3D self.Guid MDefs =3D self.Module.Defines =20 @@ -3858,7 +3833,7 @@ class ModuleAutoGen(AutoGen): 'module_uefi_hii_resource_section' : [MDefs['UEFI_HII_RESOURCE_= SECTION']] if 'UEFI_HII_RESOURCE_SECTION' in MDefs else [], 'module_uni_file' : [MDefs['MODULE_UNI_FILE']]= if 'MODULE_UNI_FILE' in MDefs else [], 'module_arch' : self.Arch, - 'package_item' : ['%s' % (Package.MetaFile.= File.replace('\\', '/')) for Package in Packages], + 'package_item' : [Package.MetaFile.File.rep= lace('\\', '/') for Package in Packages], 'binary_item' : [], 'patchablepcd_item' : [], 'pcd_item' : [], @@ -3880,12 +3855,12 @@ class ModuleAutoGen(AutoGen): AsBuiltInfDict['module_inf_version'] =3D gInfSpecVersion =20 if DriverType: - AsBuiltInfDict['pcd_is_driver_string'] +=3D [DriverType] + AsBuiltInfDict['pcd_is_driver_string'].append(DriverType) =20 if 'UEFI_SPECIFICATION_VERSION' in self.Specification: - AsBuiltInfDict['module_uefi_specification_version'] +=3D [self= .Specification['UEFI_SPECIFICATION_VERSION']] + AsBuiltInfDict['module_uefi_specification_version'].append(sel= f.Specification['UEFI_SPECIFICATION_VERSION']) if 'PI_SPECIFICATION_VERSION' in self.Specification: - AsBuiltInfDict['module_pi_specification_version'] +=3D [self.S= pecification['PI_SPECIFICATION_VERSION']] + AsBuiltInfDict['module_pi_specification_version'].append(self.= Specification['PI_SPECIFICATION_VERSION']) =20 OutputDir =3D self.OutputDir.replace('\\', '/').strip('/') DebugDir =3D self.DebugDir.replace('\\', '/').strip('/') @@ -3895,31 +3870,31 @@ class ModuleAutoGen(AutoGen): if os.path.isabs(File): File =3D File.replace('\\', '/').strip('/').replace(Output= Dir, '').strip('/') if Item.Target.Ext.lower() =3D=3D '.aml': - AsBuiltInfDict['binary_item'] +=3D ['ASL|' + File] + AsBuiltInfDict['binary_item'].append('ASL|' + File) elif Item.Target.Ext.lower() =3D=3D '.acpi': - AsBuiltInfDict['binary_item'] +=3D ['ACPI|' + File] + AsBuiltInfDict['binary_item'].append('ACPI|' + File) elif Item.Target.Ext.lower() =3D=3D '.efi': - AsBuiltInfDict['binary_item'] +=3D ['PE32|' + self.Name + = '.efi'] + AsBuiltInfDict['binary_item'].append('PE32|' + self.Name += '.efi') else: - AsBuiltInfDict['binary_item'] +=3D ['BIN|' + File] + AsBuiltInfDict['binary_item'].append('BIN|' + File) if self.DepexGenerated: self.OutputFile.add(self.Name + '.depex') if self.ModuleType in [SUP_MODULE_PEIM]: - AsBuiltInfDict['binary_item'] +=3D ['PEI_DEPEX|' + self.Na= me + '.depex'] - if self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_R= UNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]: - AsBuiltInfDict['binary_item'] +=3D ['DXE_DEPEX|' + self.Na= me + '.depex'] - if self.ModuleType in [SUP_MODULE_DXE_SMM_DRIVER]: - AsBuiltInfDict['binary_item'] +=3D ['SMM_DEPEX|' + self.Na= me + '.depex'] + AsBuiltInfDict['binary_item'].append('PEI_DEPEX|' + self.N= ame + '.depex') + elif self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE= _RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]: + AsBuiltInfDict['binary_item'].append('DXE_DEPEX|' + self.N= ame + '.depex') + elif self.ModuleType in [SUP_MODULE_DXE_SMM_DRIVER]: + AsBuiltInfDict['binary_item'].append('SMM_DEPEX|' + self.N= ame + '.depex') =20 Bin =3D self._GenOffsetBin() if Bin: - AsBuiltInfDict['binary_item'] +=3D ['BIN|%s' % Bin] + AsBuiltInfDict['binary_item'].append('BIN|%s' % Bin) self.OutputFile.add(Bin) =20 for Root, Dirs, Files in os.walk(OutputDir): for File in Files: if File.lower().endswith('.pdb'): - AsBuiltInfDict['binary_item'] +=3D ['DISPOSABLE|' + Fi= le] + AsBuiltInfDict['binary_item'].append('DISPOSABLE|' + F= ile) self.OutputFile.add(File) HeaderComments =3D self.Module.HeaderComments StartPos =3D 0 @@ -3938,12 +3913,8 @@ class ModuleAutoGen(AutoGen): ] for Item in GenList: for CName in Item[0]: - Comments =3D '' - if CName in Item[1]: - Comments =3D '\n '.join(Item[1][CName]) - Entry =3D CName - if Comments: - Entry =3D Comments + '\n ' + CName + Comments =3D '\n '.join(Item[1][CName]) if CName in Item[= 1] else '' + Entry =3D Comments + '\n ' + CName if Comments else CName AsBuiltInfDict[Item[2]].append(Entry) PatchList =3D parsePcdInfoFromMapFile( os.path.join(self.OutputDir, self.Name + '.map= '), @@ -4034,7 +4005,6 @@ class ModuleAutoGen(AutoGen): =20 HiiPcds =3D set() for Pcd in Pcds + VfrPcds: - PcdComments =3D '' PcdCommentList =3D [] HiiInfo =3D '' SkuId =3D '' @@ -4075,14 +4045,14 @@ class ModuleAutoGen(AutoGen): PcdEntry =3D Pcd.TokenSpaceGuidCName + '.' + TokenCName if PcdComments: PcdEntry =3D PcdComments + '\n ' + PcdEntry - AsBuiltInfDict['pcd_item'] +=3D [PcdEntry] + AsBuiltInfDict['pcd_item'].append(PcdEntry) for Item in self.BuildOption: if 'FLAGS' in self.BuildOption[Item]: - AsBuiltInfDict['flags_item'] +=3D ['%s:%s_%s_%s_%s_FLAGS = =3D %s' % (self.ToolChainFamily, self.BuildTarget, self.ToolChain, self.Arc= h, Item, self.BuildOption[Item]['FLAGS'].strip())] + AsBuiltInfDict['flags_item'].append('%s:%s_%s_%s_%s_FLAGS = =3D %s' % (self.ToolChainFamily, self.BuildTarget, self.ToolChain, self.Arc= h, Item, self.BuildOption[Item]['FLAGS'].strip())) =20 # Generated LibraryClasses section in comments. for Library in self.LibraryAutoGenList: - AsBuiltInfDict['libraryclasses_item'] +=3D [Library.MetaFile.F= ile.replace('\\', '/')] + AsBuiltInfDict['libraryclasses_item'].append(Library.MetaFile.= File.replace('\\', '/')) =20 # Generated UserExtensions TianoCore section. # All tianocore user extensions are copied. @@ -4095,10 +4065,8 @@ class ModuleAutoGen(AutoGen): AsBuiltInfDict['userextension_tianocore_item'] =3D UserExtStr =20 # Generated depex expression section in comments. - AsBuiltInfDict['depexsection_item'] =3D '' DepexExpresion =3D self._GetDepexExpresionString() - if DepexExpresion: - AsBuiltInfDict['depexsection_item'] =3D DepexExpresion + AsBuiltInfDict['depexsection_item'] =3D DepexExpresion if DepexExp= resion else '' =20 AsBuiltInf =3D TemplateString() AsBuiltInf.Append(gAsBuiltInfHeaderString.Replace(AsBuiltInfDict)) @@ -4317,8 +4285,7 @@ class ModuleAutoGen(AutoGen): if self.Name not in GlobalData.gModuleHash[self.Arch]: GlobalData.gModuleHash[self.Arch][self.Name] =3D m.hexdigest() if GlobalData.gBinCacheSource: - CacheValid =3D self.AttemptModuleCacheCopy() - if CacheValid: + if self.AttemptModuleCacheCopy(): return False return SaveFileOnChange(ModuleHashFile, m.hexdigest(), True) =20 @@ -4357,9 +4324,7 @@ class ModuleAutoGen(AutoGen): return self._TimeStampPath def CreateTimeStamp(self, Makefile): =20 - FileSet =3D set() - - FileSet.add (self.MetaFile.Path) + FileSet =3D {self.MetaFile.Path} =20 for SourceFile in self.Module.Sources: FileSet.add (SourceFile.Path) @@ -4423,7 +4388,7 @@ class ModuleAutoGen(AutoGen): PpiList =3D property(_GetPpiList) DepexList =3D property(_GetDepexTokenList) DxsFile =3D property(_GetDxsFile) - DepexExpressionList =3D property(_GetDepexExpressionTokenList) + DepexExpressionDict =3D property(_GetDepexExpressionTokenList) BuildOption =3D property(_GetModuleBuildOption) BuildOptionIncPathList =3D property(_GetBuildOptionIncPathList) BuildCommand =3D property(_GetBuildCommand) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 40a343ca1057..af8bfe7bba59 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1655,7 +1655,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH): TokenSpaceList =3D [] for Pcd in Info.ModulePcdList: if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenSpaceGuidCName= not in TokenSpaceList: - TokenSpaceList +=3D [Pcd.TokenSpaceGuidCName] + TokenSpaceList.append(Pcd.TokenSpaceGuidCName) =20 SkuMgr =3D Info.Workspace.Platform.SkuIdMgr AutoGenH.Append("\n// Definition of SkuId Array\n") diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/= Python/AutoGen/GenMake.py index a37350742240..e0e2ab57dd29 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -698,7 +698,7 @@ cleanlib: Src =3D self.ReplaceMacro(Src) Dst =3D self.ReplaceMacro(Dst) if Dst not in self.ResultFileList: - self.ResultFileList.append('%s' % Dst) + self.ResultFileList.append(Dst) if '%s :' %(Dst) not in self.BuildTargetList: self.BuildTargetList.append("%s :" %(Dst)) self.BuildTargetList.append('\t' + self._CP_TEMPLA= TE_[self._FileType] %{'Src': Src, 'Dst': Dst}) @@ -716,7 +716,7 @@ cleanlib: if DepsFileString =3D=3D '': continue OutputFile =3D self.ReplaceMacro(OutputFile) - self.ResultFileList.append('%s' % OutputFile) + self.ResultFileList.append(OutputFile) DepsFileString =3D self.ReplaceMacro(DepsFileString) self.BuildTargetList.append('%s : %s' % (OutputFile, DepsFileS= tring)) CmdString =3D ' '.join(FfsCmdList).strip() diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source= /Python/AutoGen/GenPcdDb.py index d2d42fe9d08e..759f9df8d9c0 100644 --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py @@ -1115,7 +1115,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): TokenSpaceGuid =3D GuidStructureStringToGuidValueName(TokenSpaceGu= idStructure) if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: if TokenSpaceGuid not in GuidList: - GuidList +=3D [TokenSpaceGuid] + GuidList.append(TokenSpaceGuid) Dict['GUID_STRUCTURE'].append(TokenSpaceGuidStructure) NumberOfExTokens +=3D 1 =20 @@ -1140,7 +1140,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): Pcd.TokenTypeList =3D ['PCD_DATUM_TYPE_' + Pcd.DatumType] =20 if len(Pcd.SkuInfoList) > 1: -# Pcd.TokenTypeList +=3D ['PCD_TYPE_SKU_ENABLED'] + NumberOfSkuEnabledPcd +=3D 1 =20 SkuIdIndex =3D 1 =20 @@ -1178,7 +1178,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): else: EdkLogger.error("build", PCD_VALIDATION_INFO_E= RROR, "The PCD '%s.%s' Validatio= n information defined in DEC file has incorrect format." % (Pcd.TokenSpaceG= uidCName, Pcd.TokenCName)) - Pcd.TokenTypeList +=3D ['PCD_TYPE_HII'] + Pcd.TokenTypeList.append('PCD_TYPE_HII') Pcd.InitString =3D 'INIT' # Store all variable names of one HII PCD under different = SKU to stringTable # and calculate the VariableHeadStringIndex @@ -1209,7 +1209,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): # store VariableGuid to GuidTable and get the VariableHead= GuidIndex =20 if VariableGuid not in GuidList: - GuidList +=3D [VariableGuid] + GuidList.append(VariableGuid) Dict['GUID_STRUCTURE'].append(VariableGuidStructure) VariableHeadGuidIndex =3D GuidList.index(VariableGuid) =20 @@ -1261,7 +1261,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): VariableDbValueList.append([VariableHeadGuidIndex, Variabl= eHeadStringIndex, Sku.VariableOffset, VariableOffset, VariableRefTable, Sku= .VariableAttribute]) =20 elif Sku.VpdOffset !=3D '': - Pcd.TokenTypeList +=3D ['PCD_TYPE_VPD'] + Pcd.TokenTypeList.append('PCD_TYPE_VPD') Pcd.InitString =3D 'INIT' VpdHeadOffsetList.append(str(Sku.VpdOffset) + 'U') VpdDbOffsetList.append(Sku.VpdOffset) @@ -1273,7 +1273,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): continue =20 if Pcd.DatumType =3D=3D TAB_VOID: - Pcd.TokenTypeList +=3D ['PCD_TYPE_STRING'] + Pcd.TokenTypeList.append('PCD_TYPE_STRING') Pcd.InitString =3D 'INIT' if Sku.HiiDefaultValue !=3D '' and Sku.DefaultValue =3D=3D= '': Sku.DefaultValue =3D Sku.HiiDefaultValue @@ -1322,7 +1322,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): StringTableSize +=3D (StringTabLen) else: if "PCD_TYPE_HII" not in Pcd.TokenTypeList: - Pcd.TokenTypeList +=3D ['PCD_TYPE_DATA'] + Pcd.TokenTypeList.append('PCD_TYPE_DATA') if Sku.DefaultValue =3D=3D 'TRUE': Pcd.InitString =3D 'INIT' else: diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/P= ython/AutoGen/GenVar.py index 2eab278d6876..3675be8de994 100644 --- a/BaseTools/Source/Python/AutoGen/GenVar.py +++ b/BaseTools/Source/Python/AutoGen/GenVar.py @@ -75,7 +75,7 @@ class VariableMgr(object): data =3D value_list[0] value_list =3D [] for data_byte in pack(data_flag,int(data,16) if data.u= pper().startswith('0X') else int(data)): - value_list +=3D [hex(unpack("B",data_byte)[0])] + value_list.append(hex(unpack("B",data_byte)[0])) newvalue[int(item.var_offset,16) if item.var_offset.upper(= ).startswith("0X") else int(item.var_offset)] =3D value_list try: newvaluestr =3D "{" + ",".join(VariableMgr.assemble_variab= le(newvalue)) +"}" diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py b/BaseTools/Sourc= e/Python/AutoGen/StrGather.py index 73af1214eb0a..ce8866f480d5 100644 --- a/BaseTools/Source/Python/AutoGen/StrGather.py +++ b/BaseTools/Source/Python/AutoGen/StrGather.py @@ -258,7 +258,7 @@ def GetFilteredLanguage(UniLanguageList, LanguageFilter= List): # first check for exact match if Language in UniLanguageList: if Language not in UniLanguageListFiltered: - UniLanguageListFiltered +=3D [Language] + UniLanguageListFiltered.append(Language) # find the first one with the same/equivalent primary tag else: if Language.find('-') !=3D -1: @@ -280,7 +280,7 @@ def GetFilteredLanguage(UniLanguageList, LanguageFilter= List): =20 if PrimaryTag =3D=3D UniLanguagePrimaryTag: if UniLanguage not in UniLanguageListFiltered: - UniLanguageListFiltered +=3D [UniLanguage] + UniLanguageListFiltered.append(UniLanguage) break else: # Here is rule 3 for "get best language" @@ -292,10 +292,10 @@ def GetFilteredLanguage(UniLanguageList, LanguageFilt= erList): for UniLanguage in UniLanguageList: if UniLanguage.startswith('en-') or UniLanguage.st= artswith('eng-'): if UniLanguage not in UniLanguageListFiltered: - UniLanguageListFiltered +=3D [UniLanguage] + UniLanguageListFiltered.append(UniLanguage) break else: - UniLanguageListFiltered +=3D [DefaultTag] + UniLanguageListFiltered.append(DefaultTag) return UniLanguageListFiltered =20 =20 diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 90350f863826..24706ebe500f 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1328,7 +1328,7 @@ def ParseFieldValue (Value): try: Value =3D "'" + uuid.UUID(Value).get_bytes_le() + "'" except ValueError, Message: - raise BadExpression('%s' % Message) + raise BadExpression(Message) Value, Size =3D ParseFieldValue(Value) return Value, 16 if Value.startswith('L"') and Value.endswith('"'): diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Py= thon/Common/String.py index 34361ecdd58c..2292a263b985 100644 --- a/BaseTools/Source/Python/Common/String.py +++ b/BaseTools/Source/Python/Common/String.py @@ -447,7 +447,7 @@ def GetMultipleValuesOfKeyFromLines(Lines, Key, KeyValu= es, CommentCharacter): for Line in LineList: Line =3D CleanString(Line, CommentCharacter) if Line !=3D '' and Line[0] !=3D CommentCharacter: - KeyValues +=3D [Line] + KeyValues.append(Line) =20 return True =20 diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Sour= ce/Python/Common/VpdInfoFile.py index 32895deb5d0c..2b447772eafe 100644 --- a/BaseTools/Source/Python/Common/VpdInfoFile.py +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py @@ -246,7 +246,7 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName): stderr=3D subprocess.PIPE, shell=3DTrue) except Exception, X: - EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData= =3D"%s" % (str(X))) + EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData= =3Dstr(X)) (out, error) =3D PopenObject.communicate() print out while PopenObject.returncode is None : diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 8a9296c49d1d..3dec57fe163a 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -2329,7 +2329,7 @@ class FdfParser: if not self.__GetNextHexNumber() and not self.__GetNextDecimalNumb= er(): raise Warning("expected Hex FV extension entry type value At L= ine ", self.FileName, self.CurrentLineNumber) =20 - FvObj.FvExtEntryTypeValue +=3D [self.__Token] + FvObj.FvExtEntryTypeValue.append(self.__Token) =20 if not self.__IsToken( "{"): raise Warning("expected '{'", self.FileName, self.CurrentLineN= umber) @@ -2337,7 +2337,7 @@ class FdfParser: if not self.__IsKeyword ("FILE") and not self.__IsKeyword ("DATA"): raise Warning("expected 'FILE' or 'DATA'", self.FileName, self= .CurrentLineNumber) =20 - FvObj.FvExtEntryType +=3D [self.__Token] + FvObj.FvExtEntryType.append(self.__Token) =20 if self.__Token =3D=3D 'DATA': =20 @@ -2371,7 +2371,7 @@ class FdfParser: raise Warning("expected '}'", self.FileName, self.CurrentL= ineNumber) =20 DataString =3D DataString.rstrip(",") - FvObj.FvExtEntryData +=3D [DataString] + FvObj.FvExtEntryData.append(DataString) =20 if self.__Token =3D=3D 'FILE': =20 @@ -2381,7 +2381,7 @@ class FdfParser: if not self.__GetNextToken(): raise Warning("expected FV Extension Entry file path At Li= ne ", self.FileName, self.CurrentLineNumber) =20 - FvObj.FvExtEntryData +=3D [self.__Token] + FvObj.FvExtEntryData.append(self.__Token) =20 if not self.__IsToken( "}"): raise Warning("expected '}'", self.FileName, self.CurrentL= ineNumber) diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseT= ools/Source/Python/GenFds/GenFdsGlobalVariable.py index 6cf82526efd2..c2e82de891d3 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -439,36 +439,33 @@ class GenFdsGlobalVariable: =20 @staticmethod def GenerateSection(Output, Input, Type=3DNone, CompressionType=3DNone= , Guid=3DNone, - GuidHdrLen=3DNone, GuidAttr=3D[], Ui=3DNone, Ver= =3DNone, InputAlign=3DNone, BuildNumber=3DNone, DummyFile=3DNone, IsMakefil= e=3DFalse): + GuidHdrLen=3DNone, GuidAttr=3D[], Ui=3DNone, Ver= =3DNone, InputAlign=3D[], BuildNumber=3DNone, DummyFile=3DNone, IsMakefile= =3DFalse): Cmd =3D ["GenSec"] if Type: - Cmd +=3D ["-s", Type] + Cmd +=3D ("-s", Type) if CompressionType: - Cmd +=3D ["-c", CompressionType] + Cmd +=3D ("-c", CompressionType) if Guid is not None: - Cmd +=3D ["-g", Guid] + Cmd +=3D ("-g", Guid) if DummyFile is not None: - Cmd +=3D ["--dummy", DummyFile] + Cmd +=3D ("--dummy", DummyFile) if GuidHdrLen: - Cmd +=3D ["-l", GuidHdrLen] - if len(GuidAttr) !=3D 0: - #Add each guided attribute - for Attr in GuidAttr: - Cmd +=3D ["-r", Attr] - if InputAlign is not None: - #Section Align is only for dummy section without section type - for SecAlign in InputAlign: - Cmd +=3D ["--sectionalign", SecAlign] + Cmd +=3D ("-l", GuidHdrLen) + #Add each guided attribute + for Attr in GuidAttr: + Cmd +=3D ("-r", Attr) + #Section Align is only for dummy section without section type + for SecAlign in InputAlign: + Cmd +=3D ("--sectionalign", SecAlign) =20 CommandFile =3D Output + '.txt' if Ui: - #Cmd +=3D ["-n", '"' + Ui + '"'] if IsMakefile: if Ui =3D=3D "$(MODULE_NAME)": - Cmd +=3D ['-n', Ui] + Cmd +=3D ('-n', Ui) else: - Cmd +=3D ["-n", '"' + Ui + '"'] - Cmd +=3D ["-o", Output] + Cmd +=3D ("-n", '"' + Ui + '"') + Cmd +=3D ("-o", Output) if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCm= dList: GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).s= trip()) else: @@ -481,10 +478,10 @@ class GenFdsGlobalVariable: SaveFileOnChange(Output, SectionData.tostring()) =20 elif Ver: - Cmd +=3D ["-n", Ver] + Cmd +=3D ("-n", Ver) if BuildNumber: - Cmd +=3D ["-j", BuildNumber] - Cmd +=3D ["-o", Output] + Cmd +=3D ("-j", BuildNumber) + Cmd +=3D ("-o", Output) =20 SaveFileOnChange(CommandFile, ' '.join(Cmd), False) if IsMakefile: @@ -495,7 +492,7 @@ class GenFdsGlobalVariable: return GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to gene= rate section") else: - Cmd +=3D ["-o", Output] + Cmd +=3D ("-o", Output) Cmd +=3D Input =20 SaveFileOnChange(CommandFile, ' '.join(Cmd), False) @@ -526,9 +523,9 @@ class GenFdsGlobalVariable: Cmd =3D ["GenFfs", "-t", Type, "-g", Guid] mFfsValidAlign =3D ["0", "8", "16", "128", "512", "1K", "4K", "32K= ", "64K", "128K", "256K", "512K", "1M", "2M", "4M", "8M", "16M"] if Fixed =3D=3D True: - Cmd +=3D ["-x"] + Cmd.append("-x") if CheckSum: - Cmd +=3D ["-s"] + Cmd.append("-s") if Align: if Align not in mFfsValidAlign: Align =3D GenFdsGlobalVariable.GetAlignment (Align) @@ -536,9 +533,9 @@ class GenFdsGlobalVariable: if ((Align > GenFdsGlobalVariable.GetAlignment(mFfsVal= idAlign[index])) and (Align <=3D GenFdsGlobalVariable.GetAlignment(mFfsVali= dAlign[index + 1]))): break Align =3D mFfsValidAlign[index + 1] - Cmd +=3D ["-a", Align] + Cmd +=3D ("-a", Align) =20 - Cmd +=3D ["-o", Output] + Cmd +=3D ("-o", Output) for I in range(0, len(Input)): Cmd +=3D ("-i", Input[I]) if SectionAlign and SectionAlign[I]: @@ -567,26 +564,26 @@ class GenFdsGlobalVariable: =20 Cmd =3D ["GenFv"] if BaseAddress: - Cmd +=3D ["-r", BaseAddress] + Cmd +=3D ("-r", BaseAddress) =20 if ForceRebase =3D=3D False: - Cmd +=3D ["-F", "FALSE"] + Cmd +=3D ("-F", "FALSE") elif ForceRebase =3D=3D True: - Cmd +=3D ["-F", "TRUE"] + Cmd +=3D ("-F", "TRUE") =20 if Capsule: - Cmd +=3D ["-c"] + Cmd.append("-c") if Dump: - Cmd +=3D ["-p"] + Cmd.append("-p") if AddressFile: - Cmd +=3D ["-a", AddressFile] + Cmd +=3D ("-a", AddressFile) if MapFile: - Cmd +=3D ["-m", MapFile] + Cmd +=3D ("-m", MapFile) if FileSystemGuid: - Cmd +=3D ["-g", FileSystemGuid] - Cmd +=3D ["-o", Output] + Cmd +=3D ("-g", FileSystemGuid) + Cmd +=3D ("-o", Output) for I in Input: - Cmd +=3D ["-i", I] + Cmd +=3D ("-i", I) =20 GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FV") =20 @@ -600,10 +597,10 @@ class GenFdsGlobalVariable: if BaseAddress and FvSize \ and len(BaseAddress) =3D=3D len(FvSize): for I in range(0, len(BaseAddress)): - Cmd +=3D ["-r", BaseAddress[I], "-s", FvSize[I]] - Cmd +=3D ["-o", Output] + Cmd +=3D ("-r", BaseAddress[I], "-s", FvSize[I]) + Cmd +=3D ("-o", Output) for F in Input: - Cmd +=3D ["-f", F] + Cmd +=3D ("-f", F) =20 GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate VTF= ") =20 @@ -617,26 +614,26 @@ class GenFdsGlobalVariable: =20 Cmd =3D ["GenFw"] if Type.lower() =3D=3D "te": - Cmd +=3D ["-t"] + Cmd.append("-t") if SubType: - Cmd +=3D ["-e", SubType] + Cmd +=3D ("-e", SubType) if TimeStamp: - Cmd +=3D ["-s", TimeStamp] + Cmd +=3D ("-s", TimeStamp) if Align: - Cmd +=3D ["-a", Align] + Cmd +=3D ("-a", Align) if Padding: - Cmd +=3D ["-p", Padding] + Cmd +=3D ("-p", Padding) if Zero: - Cmd +=3D ["-z"] + Cmd.append("-z") if Strip: - Cmd +=3D ["-l"] + Cmd.append("-l") if Replace: - Cmd +=3D ["-r"] + Cmd.append("-r") if Join: - Cmd +=3D ["-j"] + Cmd.append("-j") if Convert: - Cmd +=3D ["-m"] - Cmd +=3D ["-o", Output] + Cmd.append("-m") + Cmd +=3D ("-o", Output) Cmd +=3D Input if IsMakefile: if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdLis= t: @@ -652,18 +649,18 @@ class GenFdsGlobalVariable: if len(EfiInput) > 0: =20 if Compress: - Cmd +=3D ["-ec"] + Cmd.append("-ec") else: - Cmd +=3D ["-e"] + Cmd.append("-e") =20 for EfiFile in EfiInput: - Cmd +=3D [EfiFile] + Cmd.append(EfiFile) InputList.append (EfiFile) =20 if len(BinaryInput) > 0: - Cmd +=3D ["-b"] + Cmd.append("-b") for BinFile in BinaryInput: - Cmd +=3D [BinFile] + Cmd.append(BinFile) InputList.append (BinFile) =20 # Check List @@ -672,15 +669,15 @@ class GenFdsGlobalVariable: GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs upda= te because of newer %s" % (Output, InputList)) =20 if ClassCode is not None: - Cmd +=3D ["-l", ClassCode] + Cmd +=3D ("-l", ClassCode) if Revision is not None: - Cmd +=3D ["-r", Revision] + Cmd +=3D ("-r", Revision) if DeviceId is not None: - Cmd +=3D ["-i", DeviceId] + Cmd +=3D ("-i", DeviceId) if VendorId is not None: - Cmd +=3D ["-f", VendorId] + Cmd +=3D ("-f", VendorId) =20 - Cmd +=3D ["-o", Output] + Cmd +=3D ("-o", Output) if IsMakefile: if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdLis= t: GenFdsGlobalVariable.SecCmdList.append(" ".join(Cmd).strip= ()) @@ -695,7 +692,7 @@ class GenFdsGlobalVariable: =20 Cmd =3D [ToolPath, ] Cmd +=3D Options.split(' ') - Cmd +=3D ["-o", Output] + Cmd +=3D ("-o", Output) Cmd +=3D Input if IsMakefile: if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdLis= t: diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index cf45ef173498..4bcdea726cd3 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -420,7 +420,7 @@ class DepexReport(object): self.Source =3D "DXS" break else: - self.Depex =3D M.DepexExpressionList.get(M.ModuleType, "") + self.Depex =3D M.DepexExpressionDict.get(M.ModuleType, "") self.ModuleDepex =3D " ".join(M.Module.DepexExpression[M.Arch,= M.ModuleType]) if not self.ModuleDepex: self.ModuleDepex =3D "(None)" @@ -461,12 +461,12 @@ class DepexReport(object): FileWrite(File, "Dependency Expression (DEPEX) from %s" % self.Sou= rce) =20 if self.Source =3D=3D "INF": - FileWrite(File, "%s" % self.Depex, True) + FileWrite(File, self.Depex, True) FileWrite(File, gSubSectionSep) FileWrite(File, "From Module INF: %s" % self.ModuleDepex, Tru= e) FileWrite(File, "From Library INF: %s" % self.LibraryDepex, Tr= ue) else: - FileWrite(File, "%s" % self.Depex) + FileWrite(File, self.Depex) FileWrite(File, gSubSectionEnd) =20 ## @@ -1108,7 +1108,7 @@ class PcdReport(object): if IsByteArray: FileWrite(File, ' *M %-*s =3D %s' % (s= elf.MaxLen + 19, ModulePath, '{')) for Array in ArrayList: - FileWrite(File, '%s' % (Array)) + FileWrite(File, Array) else: FileWrite(File, ' *M %-*s =3D %s' % (s= elf.MaxLen + 19, ModulePath, ModuleDefault.strip())) =20 @@ -1134,7 +1134,7 @@ class PcdReport(object): if IsByteArray: FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'DSC= DEFAULT', "{")) for Array in ArrayList: - FileWrite(File, '%s' % (Array)) + FileWrite(File, Array) else: FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'DSC= DEFAULT', Value)) if not InfMatch and InfDefaultValue is not None: @@ -1143,7 +1143,7 @@ class PcdReport(object): if IsByteArray: FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'INF= DEFAULT', "{")) for Array in ArrayList: - FileWrite(File, '%s' % (Array)) + FileWrite(File, Array) else: FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'INF= DEFAULT', Value)) =20 @@ -1153,7 +1153,7 @@ class PcdReport(object): if IsByteArray: FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'DEC= DEFAULT', "{")) for Array in ArrayList: - FileWrite(File, '%s' % (Array)) + FileWrite(File, Array) else: FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'DEC= DEFAULT', Value)) if IsStructure: @@ -1168,7 +1168,7 @@ class PcdReport(object): if IsByteArray: FileWrite(File, ' %-*s : %6s %10s =3D %s' % (self.MaxLen= , Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '{')) for Array in ArrayList: - FileWrite(File, '%s' % (Array)) + FileWrite(File, Array) else: FileWrite(File, ' %-*s : %6s %10s =3D %s' % (self.MaxLen= , Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value)) if IsStructure: @@ -1204,7 +1204,7 @@ class PcdReport(object): else: FileWrite(File, ' %-*s : %6s %10= s %10s %10s =3D %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '= (' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '(' + DefaultStore + ')', = '{')) for Array in ArrayList: - FileWrite(File, '%s' % (Array)) + FileWrite(File, Array) else: if self.DefaultStoreSingle and self.Sk= uSingle: FileWrite(File, ' %-*s : %6s %10= s =3D %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.D= atumType + ')', Value)) @@ -1225,7 +1225,7 @@ class PcdReport(object): else: FileWrite(File, ' %-*s : %6s %10= s %10s %10s =3D %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')= ', '(' + SkuIdName + ')', '(' + DefaultStore + ')', '{')) for Array in ArrayList: - FileWrite(File, '%s' % (Array)) + FileWrite(File, Array) else: if self.DefaultStoreSingle and self.Sk= uSingle: FileWrite(File, ' %-*s : %6s %10= s =3D %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', Value)) @@ -1252,7 +1252,7 @@ class PcdReport(object): else: FileWrite(File, ' %-*s : %6s %10s %10s = =3D %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.Dat= umType + ')', '(' + SkuIdName + ')', "{")) for Array in ArrayList: - FileWrite(File, '%s' % (Array)) + FileWrite(File, Array) else: if self.SkuSingle: FileWrite(File, ' %-*s : %6s %10s =3D %s= ' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType= + ')', Value)) @@ -1265,7 +1265,7 @@ class PcdReport(object): else: FileWrite(File, ' %-*s : %6s %10s %10s = =3D %s' % (self.MaxLen, ' ' , TypeName, '(' + Pcd.DatumType + ')', '(' + Sk= uIdName + ')', "{")) for Array in ArrayList: - FileWrite(File, '%s' % (Array)) + FileWrite(File, Array) else: if self.SkuSingle: FileWrite(File, ' %-*s : %6s %10s =3D %s= ' % (self.MaxLen, ' ' , TypeName, '(' + Pcd.DatumType + ')', Value)) @@ -1932,7 +1932,7 @@ class FdReport(object): ValueList[-1] =3D ' {' FileWrite(File, '|'.join(ValueList)) for Array in ArrayList: - FileWrite(File, '%s' % (Array)) + FileWrite(File, Array) else: FileWrite(File, item) FileWrite(File, gSubSectionEnd) diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index 1ef2dc5bfe70..c16e810fed71 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -105,7 +105,7 @@ def CheckEnvVariable(): =20 WorkspaceDir =3D os.path.normcase(os.path.normpath(os.environ["WORKSPA= CE"])) if not os.path.exists(WorkspaceDir): - EdkLogger.error("build", FILE_NOT_FOUND, "WORKSPACE doesn't exist"= , ExtraData=3D"%s" % WorkspaceDir) + EdkLogger.error("build", FILE_NOT_FOUND, "WORKSPACE doesn't exist"= , ExtraData=3DWorkspaceDir) elif ' ' in WorkspaceDir: EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowe= d in WORKSPACE path", ExtraData=3DWorkspaceDir) @@ -117,7 +117,7 @@ def CheckEnvVariable(): if mws.PACKAGES_PATH: for Path in mws.PACKAGES_PATH: if not os.path.exists(Path): - EdkLogger.error("build", FILE_NOT_FOUND, "One Path in PACK= AGES_PATH doesn't exist", ExtraData=3D"%s" % Path) + EdkLogger.error("build", FILE_NOT_FOUND, "One Path in PACK= AGES_PATH doesn't exist", ExtraData=3DPath) elif ' ' in Path: EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space i= s allowed in PACKAGES_PATH", ExtraData=3DPath) =20 @@ -1543,7 +1543,7 @@ class Build(): GuidString =3D MatchGuid.group() if GuidString.upper() in ModuleList: Line =3D Line.replace(GuidString, ModuleList[G= uidString.upper()].Name) - MapBuffer.write('%s' % (Line)) + MapBuffer.write(Line) # # Add the debug image full path. # --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel