Skip to content

Commit

Permalink
BaseTools: remove cmp due to deprecated in python3
Browse files Browse the repository at this point in the history
remove cmp due to deprecated in python3

Cc: Liming Gao <[email protected]>
Cc: Yonghong Zhu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <[email protected]>
Reviewed-by: Yonghong Zhu <[email protected]>
  • Loading branch information
yunhuafx authored and Yonghong Zhu committed Aug 23, 2018
1 parent abb8e6e commit 87010d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions BaseTools/Source/Python/AutoGen/AutoGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ def _CheckAllPcdsTokenValueConflict(self):
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]
Expand All @@ -891,7 +891,7 @@ def _CheckAllPcdsTokenValueConflict(self):
#
# 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
Expand All @@ -916,7 +916,7 @@ def _CheckAllPcdsTokenValueConflict(self):
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]
Expand Down
4 changes: 2 additions & 2 deletions BaseTools/Source/Python/BPDG/GenVpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,12 @@ def FixVpdOffset (self):
# 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:
Expand Down

0 comments on commit 87010d3

Please sign in to comment.