BaseTools: AutoGen - refactor class properties

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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Carsey, Jaben 2018-09-11 06:18:03 +08:00 committed by Yonghong Zhu
parent e6c62ab768
commit 4c92c81d61

View File

@ -455,7 +455,8 @@ cleanlib:
self.FfsOutputFileList = [] self.FfsOutputFileList = []
# Compose a dict object containing information used to do replacement in template # 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_: if self._FileType not in self._SEP_:
EdkLogger.error("build", PARAMETER_INVALID, "Invalid Makefile type [%s]" % self._FileType, EdkLogger.error("build", PARAMETER_INVALID, "Invalid Makefile type [%s]" % self._FileType,
ExtraData="[%s]" % str(self._AutoGenObject)) ExtraData="[%s]" % str(self._AutoGenObject))
@ -1095,8 +1096,6 @@ cleanlib:
return DependencyList return DependencyList
_TemplateDict = property(_CreateTemplateDict)
## CustomMakefile class ## CustomMakefile class
# #
# This class encapsules makefie and its generation for module. It uses template to generate # 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)"] self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"]
# Compose a dict object containing information used to do replacement in template # Compose a dict object containing information used to do replacement in template
def _CreateTemplateDict(self): @property
def _TemplateDict(self):
Separator = self._SEP_[self._FileType] Separator = self._SEP_[self._FileType]
MyAgo = self._AutoGenObject MyAgo = self._AutoGenObject
if self._FileType not in MyAgo.CustomMakefile: if self._FileType not in MyAgo.CustomMakefile:
@ -1278,8 +1278,6 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\
return MakefileTemplateDict return MakefileTemplateDict
_TemplateDict = property(_CreateTemplateDict)
## PlatformMakefile class ## PlatformMakefile class
# #
# This class encapsules makefie and its generation for platform. It uses # This class encapsules makefie and its generation for platform. It uses
@ -1396,7 +1394,8 @@ cleanlib:
self.LibraryMakeCommandList = [] self.LibraryMakeCommandList = []
# Compose a dict object containing information used to do replacement in template # Compose a dict object containing information used to do replacement in template
def _CreateTemplateDict(self): @property
def _TemplateDict(self):
Separator = self._SEP_[self._FileType] Separator = self._SEP_[self._FileType]
MyAgo = self._AutoGenObject MyAgo = self._AutoGenObject
@ -1481,8 +1480,6 @@ cleanlib:
DirList.append(os.path.join(self._AutoGenObject.BuildDir, LibraryAutoGen.BuildDir)) DirList.append(os.path.join(self._AutoGenObject.BuildDir, LibraryAutoGen.BuildDir))
return DirList return DirList
_TemplateDict = property(_CreateTemplateDict)
## TopLevelMakefile class ## TopLevelMakefile class
# #
# This class encapsules makefie and its generation for entrance makefile. It # This class encapsules makefie and its generation for entrance makefile. It
@ -1502,7 +1499,8 @@ class TopLevelMakefile(BuildFile):
self.IntermediateDirectoryList = [] self.IntermediateDirectoryList = []
# Compose a dict object containing information used to do replacement in template # Compose a dict object containing information used to do replacement in template
def _CreateTemplateDict(self): @property
def _TemplateDict(self):
Separator = self._SEP_[self._FileType] Separator = self._SEP_[self._FileType]
# any platform autogen object is ok because we just need common information # 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)) DirList.append(os.path.join(self._AutoGenObject.BuildDir, LibraryAutoGen.BuildDir))
return DirList return DirList
_TemplateDict = property(_CreateTemplateDict)
# This acts like the main() function for the script, unless it is 'import'ed into another script. # This acts like the main() function for the script, unless it is 'import'ed into another script.
if __name__ == '__main__': if __name__ == '__main__':
pass pass