BaseTools: Customize deepcopy function.
https://bugzilla.tianocore.org/show_bug.cgi?id=1288 This patch is one of build tool performance improvement series patches. This patch is going to customize the deepcopy function for SkuClass, PcdClassObject and python dictionary. python deepcopy copy everything of a object, but for our current usage we just need to copy the data we care about recursively. By implementing __deepcopy__ for SkuClass, PcdClassObject, we can customize deepcopy function for them. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: BobCF <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@ -80,3 +80,18 @@ class SkuInfoClass(object):
|
||||
'VpdOffset = ' + str(self.VpdOffset) + "," + \
|
||||
'DefaultValue = ' + str(self.DefaultValue) + ","
|
||||
return Rtn
|
||||
|
||||
def __deepcopy__(self,memo):
|
||||
new_sku = SkuInfoClass()
|
||||
new_sku.SkuIdName = self.SkuIdName
|
||||
new_sku.SkuId = self.SkuId
|
||||
new_sku.VariableName = self.VariableName
|
||||
new_sku.VariableGuid = self.VariableGuid
|
||||
new_sku.VariableGuidValue = self.VariableGuidValue
|
||||
new_sku.VariableOffset = self.VariableOffset
|
||||
new_sku.HiiDefaultValue = self.HiiDefaultValue
|
||||
new_sku.VariableAttribute = self.VariableAttribute
|
||||
new_sku.DefaultStoreDict = {key:value for key,value in self.DefaultStoreDict.items()}
|
||||
new_sku.VpdOffset = self.VpdOffset
|
||||
new_sku.DefaultValue = self.DefaultValue
|
||||
return new_sku
|
||||
|
Reference in New Issue
Block a user