From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 1B7B82111FE63 for ; Mon, 10 Sep 2018 15:18:14 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Sep 2018 15:18:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,357,1531810800"; d="scan'208";a="72138363" Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga008.jf.intel.com with ESMTP; 10 Sep 2018 15:18:12 -0700 From: Jaben Carsey To: edk2-devel@lists.01.org Cc: Liming Gao , Yonghong Zhu Date: Mon, 10 Sep 2018 15:18:03 -0700 Message-Id: <50d31c209a61eaf3c9435194c2081d8a73e85316.1536175710.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [PATCH v2 3/9] BaseTools: AutoGen - refactor class properties X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Sep 2018 22:18:14 -0000 use function decorators Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/GenMake.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 35ee98c82bb1..b4377eef17d7 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -455,7 +455,8 @@ cleanlib: self.FfsOutputFileList = [] # Compose a dict object containing information used to do replacement in template - def _CreateTemplateDict(self): + @property + def _TemplateDict(self): if self._FileType not in self._SEP_: EdkLogger.error("build", PARAMETER_INVALID, "Invalid Makefile type [%s]" % self._FileType, ExtraData="[%s]" % str(self._AutoGenObject)) @@ -1095,8 +1096,6 @@ cleanlib: return DependencyList - _TemplateDict = property(_CreateTemplateDict) - ## CustomMakefile class # # This class encapsules makefie and its generation for module. It uses template to generate @@ -1205,7 +1204,8 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\ self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"] # Compose a dict object containing information used to do replacement in template - def _CreateTemplateDict(self): + @property + def _TemplateDict(self): Separator = self._SEP_[self._FileType] MyAgo = self._AutoGenObject if self._FileType not in MyAgo.CustomMakefile: @@ -1278,8 +1278,6 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\ return MakefileTemplateDict - _TemplateDict = property(_CreateTemplateDict) - ## PlatformMakefile class # # This class encapsules makefie and its generation for platform. It uses @@ -1396,7 +1394,8 @@ cleanlib: self.LibraryMakeCommandList = [] # Compose a dict object containing information used to do replacement in template - def _CreateTemplateDict(self): + @property + def _TemplateDict(self): Separator = self._SEP_[self._FileType] MyAgo = self._AutoGenObject @@ -1481,8 +1480,6 @@ cleanlib: DirList.append(os.path.join(self._AutoGenObject.BuildDir, LibraryAutoGen.BuildDir)) return DirList - _TemplateDict = property(_CreateTemplateDict) - ## TopLevelMakefile class # # This class encapsules makefie and its generation for entrance makefile. It @@ -1502,7 +1499,8 @@ class TopLevelMakefile(BuildFile): self.IntermediateDirectoryList = [] # Compose a dict object containing information used to do replacement in template - def _CreateTemplateDict(self): + @property + def _TemplateDict(self): Separator = self._SEP_[self._FileType] # any platform autogen object is ok because we just need common information @@ -1622,8 +1620,6 @@ class TopLevelMakefile(BuildFile): DirList.append(os.path.join(self._AutoGenObject.BuildDir, LibraryAutoGen.BuildDir)) return DirList - _TemplateDict = property(_CreateTemplateDict) - # This acts like the main() function for the script, unless it is 'import'ed into another script. if __name__ == '__main__': pass -- 2.16.2.windows.1