public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>, Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [PATCH v1 3/9] BaseTools: AutoGen - refactor class properties
Date: Wed, 29 Aug 2018 08:45:38 -0700	[thread overview]
Message-ID: <8b00680c6d5160cfdb9088471f59401ec0769f7e.1535557474.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1535557474.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1535557474.git.jaben.carsey@intel.com>

use function decorators

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
 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 55081acbd822..31b98267d4a2 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -454,7 +454,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))
@@ -1094,8 +1095,6 @@ cleanlib:
 
         return DependencyList
 
-    _TemplateDict = property(_CreateTemplateDict)
-
 ## CustomMakefile class
 #
 #  This class encapsules makefie and its generation for module. It uses template to generate
@@ -1204,7 +1203,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:
@@ -1277,8 +1277,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
@@ -1395,7 +1393,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
@@ -1480,8 +1479,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
@@ -1501,7 +1498,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
@@ -1621,8 +1619,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



  parent reply	other threads:[~2018-08-29 15:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29 15:45 [PATCH v1 0/9] BaseTools: refactor Workspace classes Jaben Carsey
2018-08-29 15:45 ` [PATCH v1 1/9] BaseTools: Refactor PlatformAutoGen Jaben Carsey
2018-08-29 15:45 ` [PATCH v1 2/9] BaseTools: AutoGen refactor WorkspaceAutoGen class Jaben Carsey
2018-08-29 15:45 ` Jaben Carsey [this message]
2018-08-29 15:45 ` [PATCH v1 4/9] BaseTools: refactor class properties Jaben Carsey
2018-08-29 15:45 ` [PATCH v1 5/9] BaseTools: Workspace classes refactor properties Jaben Carsey
2018-08-29 15:45 ` [PATCH v1 6/9] BaseTools: refactor Build Database objects Jaben Carsey
2018-08-29 15:45 ` [PATCH v1 7/9] BaseTools: Don't save unused workspace data Jaben Carsey
2018-08-29 15:45 ` [PATCH v1 8/9] BaseTools: refactor to not overcreate ModuleAutoGen objects Jaben Carsey
2018-08-29 15:45 ` [PATCH v1 9/9] BaseTools: refactor to cache InfBuildData data Jaben Carsey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b00680c6d5160cfdb9088471f59401ec0769f7e.1535557474.git.jaben.carsey@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox