Revert BaseTools: PYTHON3 migration

This reverts commit 6693f359b3c213513c5096a06c6f67244a44dc52..
678f851312.

Python3 migration is the fundamental change. It requires every developer
to install Python3. Before this migration, the well communication and wide
verification must be done. But now, most people is not aware of this change,
and not try it. So, Python3 migration is reverted and be moved to edk2-staging
Python3 branch for the edk2 user evaluation.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Liming Gao
2018-10-15 08:27:53 +08:00
parent 678f851312
commit 1ccc4d895d
182 changed files with 48049 additions and 15099 deletions

View File

@ -16,6 +16,8 @@
##
# Import Modules
#
from __future__ import print_function
from __future__ import absolute_import
import re
from . import Fd
@ -155,7 +157,7 @@ class IncludeFileProfile :
self.FileName = FileName
self.FileLinesList = []
try:
fsock = open(FileName, "r")
fsock = open(FileName, "rb", 0)
try:
self.FileLinesList = fsock.readlines()
for index, line in enumerate(self.FileLinesList):
@ -216,7 +218,7 @@ class FileProfile :
def __init__(self, FileName):
self.FileLinesList = []
try:
fsock = open(FileName, "r")
fsock = open(FileName, "rb", 0)
try:
self.FileLinesList = fsock.readlines()
finally:
@ -1615,7 +1617,7 @@ class FdfParser:
self.SetPcdLocalation(pcdPair)
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple
Obj.Size = int(Size, 0)
Obj.Size = long(Size, 0)
return True
if self.__IsKeyword( "ErasePolarity"):
@ -1651,7 +1653,7 @@ class FdfParser:
if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():
raise Warning("expected address", self.FileName, self.CurrentLineNumber)
BsAddress = int(self.__Token, 0)
BsAddress = long(self.__Token, 0)
Obj.BsBaseAddress = BsAddress
if self.__IsKeyword("RtBaseAddress"):
@ -1661,7 +1663,7 @@ class FdfParser:
if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():
raise Warning("expected address", self.FileName, self.CurrentLineNumber)
RtAddress = int(self.__Token, 0)
RtAddress = long(self.__Token, 0)
Obj.RtBaseAddress = RtAddress
## __GetBlockStatements() method
@ -1709,7 +1711,7 @@ class FdfParser:
self.SetPcdLocalation(PcdPair)
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
self.Profile.PcdFileLineDict[PcdPair] = FileLineTuple
BlockSize = int(BlockSize, 0)
BlockSize = long(BlockSize, 0)
BlockNumber = None
if self.__IsKeyword( "NumBlocks"):
@ -1719,7 +1721,7 @@ class FdfParser:
if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():
raise Warning("expected block numbers", self.FileName, self.CurrentLineNumber)
BlockNumber = int(self.__Token, 0)
BlockNumber = long(self.__Token, 0)
Obj.BlockSizeList.append((BlockSize, BlockNumber, BlockSizePcd))
return True
@ -1828,7 +1830,7 @@ class FdfParser:
Expr += CurCh
self.__GetOneChar()
try:
return int(
return long(
ValueExpression(Expr,
self.__CollectMacroPcd()
)(True), 0)
@ -1876,7 +1878,7 @@ class FdfParser:
RegionOffsetPcdPattern.match(self.__CurrentLine()[self.CurrentOffsetWithinLine:]))
if IsRegionPcd:
RegionObj.PcdOffset = self.__GetNextPcdSettings()
self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + int(Fd.BaseAddress, 0))
self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + long(Fd.BaseAddress, 0))
self.SetPcdLocalation(RegionObj.PcdOffset)
self.__PcdDict['%s.%s' % (RegionObj.PcdOffset[1], RegionObj.PcdOffset[0])] = "0x%x" % RegionObj.Offset
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
@ -3231,9 +3233,9 @@ class FdfParser:
if FdfParser.__Verify(Name, Value, 'UINT64'):
FmpData.MonotonicCount = Value
if FmpData.MonotonicCount.upper().startswith('0X'):
FmpData.MonotonicCount = (int)(FmpData.MonotonicCount, 16)
FmpData.MonotonicCount = (long)(FmpData.MonotonicCount, 16)
else:
FmpData.MonotonicCount = (int)(FmpData.MonotonicCount)
FmpData.MonotonicCount = (long)(FmpData.MonotonicCount)
if not self.__GetNextToken():
break
else: