From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 E8AF4225264A7 for ; Thu, 5 Apr 2018 16:14:07 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2018 16:14:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,412,1517904000"; d="scan'208";a="189047113" Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.141]) by orsmga004.jf.intel.com with ESMTP; 05 Apr 2018 16:14:05 -0700 From: Jaben Carsey To: edk2-devel@lists.01.org Cc: Liming Gao , Yonghong Zhu Date: Thu, 5 Apr 2018 16:14:00 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [PATCH v1 12/14] BaseTools: change more list to set X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 23:14:08 -0000 potentially accelerate "in" testing remove uncalled function Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 5 ++-- BaseTools/Source/Python/AutoGen/BuildEngine.py | 29 ++++++-------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 42536a61535a..342cd618c605 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -4191,7 +4191,7 @@ class ModuleAutoGen(AutoGen): PcdItem = PcdComments + '\n ' + PcdItem AsBuiltInfDict['patchablepcd_item'].append(PcdItem) - HiiPcds = [] + HiiPcds = set() for Pcd in Pcds + VfrPcds: PcdComments = '' PcdCommentList = [] @@ -4214,8 +4214,7 @@ class ModuleAutoGen(AutoGen): # if (SkuId, Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in HiiPcds: continue - else: - HiiPcds.append((SkuId, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) + HiiPcds.add((SkuId, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in self._PcdComments: PcdCommentList = self._PcdComments[Pcd.TokenSpaceGuidCName, Pcd.TokenCName][:] if HiiInfo: diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py index 0daed7da610d..1663ddd21bb0 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -161,7 +161,7 @@ class FileBuildRule: # Check input files self.IsMultipleInput = False - self.SourceFileExtList = [] + self.SourceFileExtList = set() for File in Input: Base, Ext = os.path.splitext(File) if Base.find("*") >= 0: @@ -172,8 +172,7 @@ class FileBuildRule: # There's no "*" and "?" in file name self.ExtraSourceFileList.append(File) continue - if Ext not in self.SourceFileExtList: - self.SourceFileExtList.append(Ext) + self.SourceFileExtList.add(Ext) # Check output files self.DestFileList = [] @@ -194,16 +193,6 @@ class FileBuildRule: CommandString = "\n\t".join(self.CommandList) return "%s : %s\n\t%s" % (DestString, SourceString, CommandString) - ## Check if given file extension is supported by this rule - # - # @param FileExt The extension of a file - # - # @retval True If the extension is supported - # @retval False If the extension is not supported - # - def IsSupported(self, FileExt): - return FileExt in self.SourceFileExtList - def Instantiate(self, Macros={}): NewRuleObject = copy.copy(self) NewRuleObject.BuildTargets = {} @@ -365,8 +354,8 @@ class BuildRule: self._State = "" self._RuleInfo = tdict(True, 2) # {toolchain family : {"InputFile": {}, "OutputFile" : [], "Command" : []}} self._FileType = '' - self._BuildTypeList = [] - self._ArchList = [] + self._BuildTypeList = set() + self._ArchList = set() self._FamilyList = [] self._TotalToolChainFamilySet = set() self._RuleObjectList = [] # FileBuildRule object list @@ -456,8 +445,8 @@ class BuildRule: # def ParseSectionHeader(self, LineIndex): self._RuleInfo = tdict(True, 2) - self._BuildTypeList = [] - self._ArchList = [] + self._BuildTypeList = set() + self._ArchList = set() self._FamilyList = [] self._TotalToolChainFamilySet = set() FileType = '' @@ -494,10 +483,8 @@ class BuildRule: BuildType = TokenList[1] if len(TokenList) > 2: Arch = TokenList[2] - if BuildType not in self._BuildTypeList: - self._BuildTypeList.append(BuildType) - if Arch not in self._ArchList: - self._ArchList.append(Arch) + self._BuildTypeList.add(BuildType) + self._ArchList.add(Arch) if 'COMMON' in self._BuildTypeList and len(self._BuildTypeList) > 1: EdkLogger.error("build", FORMAT_INVALID, -- 2.16.2.windows.1