diff options
author | Liming Gao <liming.gao@intel.com> | 2018-10-15 08:27:53 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2018-10-15 08:29:14 +0800 |
commit | 1ccc4d895dd8d659d016efcd6ef8a48749aba1d0 (patch) | |
tree | 0d5f58643cc72275887d3bb322813609906a9334 /BaseTools/Source/Python/GenFds/FdfParser.py | |
parent | 678f85131238622e576705117e299d81cff755c9 (diff) | |
download | edk2-1ccc4d895dd8d659d016efcd6ef8a48749aba1d0.tar.gz edk2-1ccc4d895dd8d659d016efcd6ef8a48749aba1d0.tar.bz2 edk2-1ccc4d895dd8d659d016efcd6ef8a48749aba1d0.zip |
Revert BaseTools: PYTHON3 migration
This reverts commit 6693f359b3c213513c5096a06c6f67244a44dc52..
678f85131238622e576705117e299d81cff755c9.
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>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/FdfParser.py')
-rw-r--r-- | BaseTools/Source/Python/GenFds/FdfParser.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index ff8ccf21bd..63687e98bb 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -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:
|