From 87010d3d02547c81f1add57a4e2ef0483c65fddf Mon Sep 17 00:00:00 2001 From: "Feng, YunhuaX" Date: Wed, 8 Aug 2018 14:56:14 +0800 Subject: [PATCH] BaseTools: remove cmp due to deprecated in python3 remove cmp due to deprecated in python3 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py | 6 +++--- BaseTools/Source/Python/BPDG/GenVpd.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 7bca6fb426..eb1b283889 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -870,7 +870,7 @@ class WorkspaceAutoGen(AutoGen): for Pa in self.AutoGenObjectList: for Package in Pa.PackageList: PcdList = Package.Pcds.values() - PcdList.sort(lambda x, y: cmp(int(x.TokenValue, 0), int(y.TokenValue, 0))) + PcdList.sort(key=lambda x: int(x.TokenValue, 0)) Count = 0 while (Count < len(PcdList) - 1) : Item = PcdList[Count] @@ -891,7 +891,7 @@ class WorkspaceAutoGen(AutoGen): # # Sort same token value PCD list with TokenGuid and TokenCName # - SameTokenValuePcdList.sort(lambda x, y: cmp("%s.%s" % (x.TokenSpaceGuidCName, x.TokenCName), "%s.%s" % (y.TokenSpaceGuidCName, y.TokenCName))) + SameTokenValuePcdList.sort(key=lambda x: "%s.%s" % (x.TokenSpaceGuidCName, x.TokenCName)) SameTokenValuePcdListCount = 0 while (SameTokenValuePcdListCount < len(SameTokenValuePcdList) - 1): Flag = False @@ -916,7 +916,7 @@ class WorkspaceAutoGen(AutoGen): Count += 1 PcdList = Package.Pcds.values() - PcdList.sort(lambda x, y: cmp("%s.%s" % (x.TokenSpaceGuidCName, x.TokenCName), "%s.%s" % (y.TokenSpaceGuidCName, y.TokenCName))) + PcdList.sort(key=lambda x: "%s.%s" % (x.TokenSpaceGuidCName, x.TokenCName)) Count = 0 while (Count < len(PcdList) - 1) : Item = PcdList[Count] diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/BPDG/GenVpd.py index cd272a2d9a..c5e91a3e81 100644 --- a/BaseTools/Source/Python/BPDG/GenVpd.py +++ b/BaseTools/Source/Python/BPDG/GenVpd.py @@ -504,12 +504,12 @@ class GenVPD : # Sort fixed offset list in order to find out where has free spaces for the pcd's offset # value is "*" to insert into. - self.PcdFixedOffsetSizeList.sort(lambda x, y: cmp(x.PcdBinOffset, y.PcdBinOffset)) + self.PcdFixedOffsetSizeList.sort(key=lambda x: x.PcdBinOffset) # # Sort the un-fixed pcd's offset by it's size. # - self.PcdUnknownOffsetList.sort(lambda x, y: cmp(x.PcdBinSize, y.PcdBinSize)) + self.PcdUnknownOffsetList.sort(key=lambda x: x.PcdBinSize) index =0 for pcd in self.PcdUnknownOffsetList: -- 2.39.2