mirror of https://github.com/acidanthera/audk.git
BaseTools: Rename long() to int()
Because the long() function was not exist in Python3. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
261eee25de
commit
8371d87412
|
@ -57,7 +57,7 @@ class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
|
||||||
itemIndex += 1
|
itemIndex += 1
|
||||||
realLength += 5
|
realLength += 5
|
||||||
for v_data in item.data:
|
for v_data in item.data:
|
||||||
if type(v_data) in (int, long):
|
if isinstance(v_data, int):
|
||||||
realLength += item.StorageWidth
|
realLength += item.StorageWidth
|
||||||
else:
|
else:
|
||||||
realLength += item.StorageWidth
|
realLength += item.StorageWidth
|
||||||
|
@ -137,7 +137,7 @@ class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
|
||||||
Buffer += b
|
Buffer += b
|
||||||
realLength += 1
|
realLength += 1
|
||||||
for v_data in item.data:
|
for v_data in item.data:
|
||||||
if type(v_data) in (int, long):
|
if isinstance(v_data, int):
|
||||||
b = pack(PACK_CODE_BY_SIZE[item.StorageWidth], v_data)
|
b = pack(PACK_CODE_BY_SIZE[item.StorageWidth], v_data)
|
||||||
Buffer += b
|
Buffer += b
|
||||||
realLength += item.StorageWidth
|
realLength += item.StorageWidth
|
||||||
|
|
|
@ -1591,7 +1591,7 @@ def CheckPcdDatum(Type, Value):
|
||||||
if Value and int(Value, 0) < 0:
|
if Value and int(Value, 0) < 0:
|
||||||
return False, "PCD can't be set to negative value[%s] for datum type [%s]" % (Value, Type)
|
return False, "PCD can't be set to negative value[%s] for datum type [%s]" % (Value, Type)
|
||||||
try:
|
try:
|
||||||
Value = long(Value, 0)
|
Value = int(Value, 0)
|
||||||
if Value > MAX_VAL_TYPE[Type]:
|
if Value > MAX_VAL_TYPE[Type]:
|
||||||
return False, "Too large PCD value[%s] for datum type [%s]" % (Value, Type)
|
return False, "Too large PCD value[%s] for datum type [%s]" % (Value, Type)
|
||||||
except:
|
except:
|
||||||
|
@ -2081,7 +2081,7 @@ def PackRegistryFormatGuid(Guid):
|
||||||
# @retval Value The integer value that the input represents
|
# @retval Value The integer value that the input represents
|
||||||
#
|
#
|
||||||
def GetIntegerValue(Input):
|
def GetIntegerValue(Input):
|
||||||
if type(Input) in (int, long):
|
if isinstance(Input, int):
|
||||||
return Input
|
return Input
|
||||||
String = Input
|
String = Input
|
||||||
if String.endswith("U"):
|
if String.endswith("U"):
|
||||||
|
|
|
@ -96,7 +96,7 @@ class AprioriSection (AprioriSectionClassObject):
|
||||||
|
|
||||||
|
|
||||||
GuidPart = Guid.split('-')
|
GuidPart = Guid.split('-')
|
||||||
Buffer.write(pack('I', long(GuidPart[0], 16)))
|
Buffer.write(pack('I', int(GuidPart[0], 16)))
|
||||||
Buffer.write(pack('H', int(GuidPart[1], 16)))
|
Buffer.write(pack('H', int(GuidPart[1], 16)))
|
||||||
Buffer.write(pack('H', int(GuidPart[2], 16)))
|
Buffer.write(pack('H', int(GuidPart[2], 16)))
|
||||||
|
|
||||||
|
|
|
@ -1615,7 +1615,7 @@ class FdfParser:
|
||||||
self.SetPcdLocalation(pcdPair)
|
self.SetPcdLocalation(pcdPair)
|
||||||
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
||||||
self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple
|
self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple
|
||||||
Obj.Size = long(Size, 0)
|
Obj.Size = int(Size, 0)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if self.__IsKeyword( "ErasePolarity"):
|
if self.__IsKeyword( "ErasePolarity"):
|
||||||
|
@ -1651,7 +1651,7 @@ class FdfParser:
|
||||||
if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():
|
if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():
|
||||||
raise Warning("expected address", self.FileName, self.CurrentLineNumber)
|
raise Warning("expected address", self.FileName, self.CurrentLineNumber)
|
||||||
|
|
||||||
BsAddress = long(self.__Token, 0)
|
BsAddress = int(self.__Token, 0)
|
||||||
Obj.BsBaseAddress = BsAddress
|
Obj.BsBaseAddress = BsAddress
|
||||||
|
|
||||||
if self.__IsKeyword("RtBaseAddress"):
|
if self.__IsKeyword("RtBaseAddress"):
|
||||||
|
@ -1661,7 +1661,7 @@ class FdfParser:
|
||||||
if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():
|
if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():
|
||||||
raise Warning("expected address", self.FileName, self.CurrentLineNumber)
|
raise Warning("expected address", self.FileName, self.CurrentLineNumber)
|
||||||
|
|
||||||
RtAddress = long(self.__Token, 0)
|
RtAddress = int(self.__Token, 0)
|
||||||
Obj.RtBaseAddress = RtAddress
|
Obj.RtBaseAddress = RtAddress
|
||||||
|
|
||||||
## __GetBlockStatements() method
|
## __GetBlockStatements() method
|
||||||
|
@ -1709,7 +1709,7 @@ class FdfParser:
|
||||||
self.SetPcdLocalation(PcdPair)
|
self.SetPcdLocalation(PcdPair)
|
||||||
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
||||||
self.Profile.PcdFileLineDict[PcdPair] = FileLineTuple
|
self.Profile.PcdFileLineDict[PcdPair] = FileLineTuple
|
||||||
BlockSize = long(BlockSize, 0)
|
BlockSize = int(BlockSize, 0)
|
||||||
|
|
||||||
BlockNumber = None
|
BlockNumber = None
|
||||||
if self.__IsKeyword( "NumBlocks"):
|
if self.__IsKeyword( "NumBlocks"):
|
||||||
|
@ -1719,7 +1719,7 @@ class FdfParser:
|
||||||
if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():
|
if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():
|
||||||
raise Warning("expected block numbers", self.FileName, self.CurrentLineNumber)
|
raise Warning("expected block numbers", self.FileName, self.CurrentLineNumber)
|
||||||
|
|
||||||
BlockNumber = long(self.__Token, 0)
|
BlockNumber = int(self.__Token, 0)
|
||||||
|
|
||||||
Obj.BlockSizeList.append((BlockSize, BlockNumber, BlockSizePcd))
|
Obj.BlockSizeList.append((BlockSize, BlockNumber, BlockSizePcd))
|
||||||
return True
|
return True
|
||||||
|
@ -1828,7 +1828,7 @@ class FdfParser:
|
||||||
Expr += CurCh
|
Expr += CurCh
|
||||||
self.__GetOneChar()
|
self.__GetOneChar()
|
||||||
try:
|
try:
|
||||||
return long(
|
return int(
|
||||||
ValueExpression(Expr,
|
ValueExpression(Expr,
|
||||||
self.__CollectMacroPcd()
|
self.__CollectMacroPcd()
|
||||||
)(True), 0)
|
)(True), 0)
|
||||||
|
@ -1876,7 +1876,7 @@ class FdfParser:
|
||||||
RegionOffsetPcdPattern.match(self.__CurrentLine()[self.CurrentOffsetWithinLine:]))
|
RegionOffsetPcdPattern.match(self.__CurrentLine()[self.CurrentOffsetWithinLine:]))
|
||||||
if IsRegionPcd:
|
if IsRegionPcd:
|
||||||
RegionObj.PcdOffset = self.__GetNextPcdSettings()
|
RegionObj.PcdOffset = self.__GetNextPcdSettings()
|
||||||
self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + long(Fd.BaseAddress, 0))
|
self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + int(Fd.BaseAddress, 0))
|
||||||
self.SetPcdLocalation(RegionObj.PcdOffset)
|
self.SetPcdLocalation(RegionObj.PcdOffset)
|
||||||
self.__PcdDict['%s.%s' % (RegionObj.PcdOffset[1], RegionObj.PcdOffset[0])] = "0x%x" % RegionObj.Offset
|
self.__PcdDict['%s.%s' % (RegionObj.PcdOffset[1], RegionObj.PcdOffset[0])] = "0x%x" % RegionObj.Offset
|
||||||
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
||||||
|
@ -3231,9 +3231,9 @@ class FdfParser:
|
||||||
if FdfParser.__Verify(Name, Value, 'UINT64'):
|
if FdfParser.__Verify(Name, Value, 'UINT64'):
|
||||||
FmpData.MonotonicCount = Value
|
FmpData.MonotonicCount = Value
|
||||||
if FmpData.MonotonicCount.upper().startswith('0X'):
|
if FmpData.MonotonicCount.upper().startswith('0X'):
|
||||||
FmpData.MonotonicCount = (long)(FmpData.MonotonicCount, 16)
|
FmpData.MonotonicCount = (int)(FmpData.MonotonicCount, 16)
|
||||||
else:
|
else:
|
||||||
FmpData.MonotonicCount = (long)(FmpData.MonotonicCount)
|
FmpData.MonotonicCount = (int)(FmpData.MonotonicCount)
|
||||||
if not self.__GetNextToken():
|
if not self.__GetNextToken():
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -557,9 +557,9 @@ class GenFds :
|
||||||
GenFdsGlobalVariable.InfLogger('\nFV Space Information')
|
GenFdsGlobalVariable.InfLogger('\nFV Space Information')
|
||||||
for FvSpaceInfo in FvSpaceInfoList:
|
for FvSpaceInfo in FvSpaceInfoList:
|
||||||
Name = FvSpaceInfo[0]
|
Name = FvSpaceInfo[0]
|
||||||
TotalSizeValue = long(FvSpaceInfo[1], 0)
|
TotalSizeValue = int(FvSpaceInfo[1], 0)
|
||||||
UsedSizeValue = long(FvSpaceInfo[2], 0)
|
UsedSizeValue = int(FvSpaceInfo[2], 0)
|
||||||
FreeSizeValue = long(FvSpaceInfo[3], 0)
|
FreeSizeValue = int(FvSpaceInfo[3], 0)
|
||||||
if UsedSizeValue == TotalSizeValue:
|
if UsedSizeValue == TotalSizeValue:
|
||||||
Percentage = '100'
|
Percentage = '100'
|
||||||
else:
|
else:
|
||||||
|
@ -585,7 +585,7 @@ class GenFds :
|
||||||
if PcdValue == '':
|
if PcdValue == '':
|
||||||
return
|
return
|
||||||
|
|
||||||
Int64PcdValue = long(PcdValue, 0)
|
Int64PcdValue = int(PcdValue, 0)
|
||||||
if Int64PcdValue == 0 or Int64PcdValue < -1:
|
if Int64PcdValue == 0 or Int64PcdValue < -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -140,11 +140,11 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if args.MonotonicCountStr.upper().startswith('0X'):
|
if args.MonotonicCountStr.upper().startswith('0X'):
|
||||||
args.MonotonicCountValue = (long)(args.MonotonicCountStr, 16)
|
args.MonotonicCountValue = (int)(args.MonotonicCountStr, 16)
|
||||||
else:
|
else:
|
||||||
args.MonotonicCountValue = (long)(args.MonotonicCountStr)
|
args.MonotonicCountValue = (int)(args.MonotonicCountStr)
|
||||||
except:
|
except:
|
||||||
args.MonotonicCountValue = (long)(0)
|
args.MonotonicCountValue = (int)(0)
|
||||||
|
|
||||||
if args.Encode:
|
if args.Encode:
|
||||||
#
|
#
|
||||||
|
@ -250,9 +250,9 @@ if __name__ == '__main__':
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
if args.SignatureSizeStr.upper().startswith('0X'):
|
if args.SignatureSizeStr.upper().startswith('0X'):
|
||||||
SignatureSize = (long)(args.SignatureSizeStr, 16)
|
SignatureSize = (int)(args.SignatureSizeStr, 16)
|
||||||
else:
|
else:
|
||||||
SignatureSize = (long)(args.SignatureSizeStr)
|
SignatureSize = (int)(args.SignatureSizeStr)
|
||||||
if SignatureSize < 0:
|
if SignatureSize < 0:
|
||||||
print("ERROR: The value of option --signature-size can't be set to negative value!")
|
print("ERROR: The value of option --signature-size can't be set to negative value!")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -162,9 +162,9 @@ if __name__ == '__main__':
|
||||||
if args.MonotonicCountStr:
|
if args.MonotonicCountStr:
|
||||||
try:
|
try:
|
||||||
if args.MonotonicCountStr.upper().startswith('0X'):
|
if args.MonotonicCountStr.upper().startswith('0X'):
|
||||||
args.MonotonicCountValue = (long)(args.MonotonicCountStr, 16)
|
args.MonotonicCountValue = (int)(args.MonotonicCountStr, 16)
|
||||||
else:
|
else:
|
||||||
args.MonotonicCountValue = (long)(args.MonotonicCountStr)
|
args.MonotonicCountValue = (int)(args.MonotonicCountStr)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue