[edk2] [PATCH v2 07/20] BaseTools: Import reduce() from functools

Gary Lin posted 20 patches 6 years, 10 months ago
There is a newer version of this series
[edk2] [PATCH v2 07/20] BaseTools: Import reduce() from functools
Posted by Gary Lin 6 years, 10 months ago
In python3, reduce() is not a built-in function anymore.
Import it from "functools" to be compatible with python 3.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
---
 BaseTools/Source/Python/AutoGen/GenPcdDb.py | 1 +
 BaseTools/Source/Python/AutoGen/GenVar.py   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index b4955ea7ebab..a989cb34dff3 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -21,6 +21,7 @@ from ValidCheckingInfoObject import VAR_VALID_OBJECT_FACTORY
 from Common.VariableAttributes import VariableAttributes
 import copy
 from struct import unpack
+from functools import reduce
 
 DATABASE_VERSION = 7
 
diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/Python/AutoGen/GenVar.py
index 8e800c8bc914..b82d7e4d2d37 100644
--- a/BaseTools/Source/Python/AutoGen/GenVar.py
+++ b/BaseTools/Source/Python/AutoGen/GenVar.py
@@ -21,6 +21,7 @@ import copy
 from Common.VariableAttributes import VariableAttributes
 from Common.Misc import *
 import collections
+from functools import reduce
 
 var_info = collections.namedtuple("uefi_var", "pcdindex,pcdname,defaultstoragename,skuname,var_name, var_guid, var_offset,var_attribute,pcd_default_value, default_value, data_type")
 NvStorageHeaderSize = 28
-- 
2.16.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel