From 1ccc4d895dd8d659d016efcd6ef8a48749aba1d0 Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Mon, 15 Oct 2018 08:27:53 +0800 Subject: 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 --- BaseTools/Source/Python/UPT/Parser/DecParser.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'BaseTools/Source/Python/UPT/Parser/DecParser.py') diff --git a/BaseTools/Source/Python/UPT/Parser/DecParser.py b/BaseTools/Source/Python/UPT/Parser/DecParser.py index 51dc4b2bd2..a88b51d055 100644 --- a/BaseTools/Source/Python/UPT/Parser/DecParser.py +++ b/BaseTools/Source/Python/UPT/Parser/DecParser.py @@ -620,11 +620,11 @@ class _DecPcd(_DecBase): if not IsValidToken(PCD_TOKEN_PATTERN, Token): self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN % Token) elif not Token.startswith('0x') and not Token.startswith('0X'): - if int(Token) > 4294967295: + if long(Token) > 4294967295: self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN_INT % Token) - Token = hex(int(Token)) + Token = hex(long(Token))[:-1] - IntToken = int(Token, 0) + IntToken = long(Token, 0) if (Guid, IntToken) in self.TokenMap: if self.TokenMap[Guid, IntToken] != CName: self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN_UNIQUE%(Token)) @@ -752,7 +752,7 @@ class _DecUserExtension(_DecBase): class Dec(_DecBase, _DecComments): def __init__(self, DecFile, Parse = True): try: - Content = ConvertSpecialChar(open(DecFile, 'r').readlines()) + Content = ConvertSpecialChar(open(DecFile, 'rb').readlines()) except BaseException: Logger.Error(TOOL_NAME, FILE_OPEN_FAILURE, File=DecFile, ExtraData=ST.ERR_DECPARSE_FILEOPEN % DecFile) -- cgit v1.2.3