From 1b2e077260030290c512f3ac71a044ed1150899f Mon Sep 17 00:00:00 2001 From: Yonghong Zhu Date: Tue, 4 Sep 2018 10:39:47 +0800 Subject: BaseTools/UPT: Porting UPT Tool from Python2 to Python3 Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu Reviewed-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 a88b51d055..51dc4b2bd2 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 long(Token) > 4294967295: + if int(Token) > 4294967295: self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN_INT % Token) - Token = hex(long(Token))[:-1] + Token = hex(int(Token)) - IntToken = long(Token, 0) + IntToken = int(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, 'rb').readlines()) + Content = ConvertSpecialChar(open(DecFile, 'r').readlines()) except BaseException: Logger.Error(TOOL_NAME, FILE_OPEN_FAILURE, File=DecFile, ExtraData=ST.ERR_DECPARSE_FILEOPEN % DecFile) -- cgit v1.2.3