summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/CommonDataClass
diff options
context:
space:
mode:
authorBobCF <bob.c.feng@intel.com>2018-11-08 14:03:38 +0800
committerBobCF <bob.c.feng@intel.com>2018-12-07 10:31:04 +0800
commitbf9e636605188e291d33ab694ff1c5926b6f0800 (patch)
treeed9c6534d4cda516d290f979ba2848a882928508 /BaseTools/Source/Python/CommonDataClass
parent4e375707392e4f9085e2d2342e41aee9d4df2b0a (diff)
downloadedk2-bf9e636605188e291d33ab694ff1c5926b6f0800.tar.gz
edk2-bf9e636605188e291d33ab694ff1c5926b6f0800.tar.bz2
edk2-bf9e636605188e291d33ab694ff1c5926b6f0800.zip
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>
Diffstat (limited to 'BaseTools/Source/Python/CommonDataClass')
-rw-r--r--BaseTools/Source/Python/CommonDataClass/CommonClass.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/CommonDataClass/CommonClass.py b/BaseTools/Source/Python/CommonDataClass/CommonClass.py
index a98cf8a7c5..336bb11671 100644
--- a/BaseTools/Source/Python/CommonDataClass/CommonClass.py
+++ b/BaseTools/Source/Python/CommonDataClass/CommonClass.py
@@ -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