diff options
Diffstat (limited to 'BaseTools/Source/Python/UPT/Parser')
5 files changed, 12 insertions, 12 deletions
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)
diff --git a/BaseTools/Source/Python/UPT/Parser/DecParserMisc.py b/BaseTools/Source/Python/UPT/Parser/DecParserMisc.py index cd4d87224d..c5c35ede78 100644 --- a/BaseTools/Source/Python/UPT/Parser/DecParserMisc.py +++ b/BaseTools/Source/Python/UPT/Parser/DecParserMisc.py @@ -151,7 +151,7 @@ def IsValidNumValUint8(Token): else:
Base = 10
try:
- TokenValue = int(Token, Base)
+ TokenValue = long(Token, Base)
except BaseException:
Valid, Cause = IsValidLogicalExpr(Token, True)
if Cause:
@@ -262,7 +262,7 @@ def IsValidPcdDatum(Type, Value): Value = Value.lstrip('0')
if not Value:
return True, ""
- Value = int(Value, 0)
+ Value = long(Value, 0)
TypeLenMap = {
#
# 0x00 - 0xff
diff --git a/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py b/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py index 3c313a089d..029a436cec 100644 --- a/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py +++ b/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py @@ -205,7 +205,7 @@ def GetFileLineContent(FileName, WorkSpace, LineNo, OriginalString): try:
FullFileName = FullFileName.replace('\\', '/')
- Inputfile = open(FullFileName, "r")
+ Inputfile = open(FullFileName, "rb", 0)
try:
FileLinesList = Inputfile.readlines()
except BaseException:
diff --git a/BaseTools/Source/Python/UPT/Parser/InfParser.py b/BaseTools/Source/Python/UPT/Parser/InfParser.py index d17d2c887b..cd99262e03 100644 --- a/BaseTools/Source/Python/UPT/Parser/InfParser.py +++ b/BaseTools/Source/Python/UPT/Parser/InfParser.py @@ -51,7 +51,7 @@ def OpenInfFile(Filename): FileLinesList = []
try:
- FInputfile = open(Filename, "r")
+ FInputfile = open(Filename, "rb", 0)
try:
FileLinesList = FInputfile.readlines()
except BaseException:
@@ -86,7 +86,7 @@ class InfParser(InfSectionParser): #
# Call parent class construct function
#
- super().__init__()
+ super(InfParser, self).__init__()
self.WorkspaceDir = WorkspaceDir
self.SupArchList = DT.ARCH_LIST
diff --git a/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py index 44243b467b..1f254058d1 100644 --- a/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py +++ b/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py @@ -206,7 +206,7 @@ class InfSectionParser(InfDefinSectionParser, if FilePath in cls.MetaFiles:
return cls.MetaFiles[FilePath]
else:
- ParserObject = super().__new__(cls)
+ ParserObject = super(InfSectionParser, cls).__new__(cls)
cls.MetaFiles[FilePath] = ParserObject
return ParserObject
@@ -227,7 +227,7 @@ class InfSectionParser(InfDefinSectionParser, self.InfBuildOptionSection = InfBuildOptionsObject()
self.InfLibraryClassSection = InfLibraryClassObject()
self.InfPackageSection = InfPackageObject()
- self.InfPcdSection = InfPcdObject(list(self.MetaFiles.keys())[0])
+ self.InfPcdSection = InfPcdObject(self.MetaFiles.keys()[0])
self.InfSourcesSection = InfSourcesObject()
self.InfUserExtensionSection = InfUserExtensionObject()
self.InfProtocolSection = InfProtocolObject()
@@ -455,7 +455,7 @@ class InfSectionParser(InfDefinSectionParser, Arch = Match.groups(1)[0].upper()
ArchList.append(Arch)
CommentSoFar = ''
- for Index in range(1, len(List)):
+ for Index in xrange(1, len(List)):
Result = ParseComment(List[Index], DT.ALL_USAGE_TOKENS, TokenDict, [], False)
Usage = Result[0]
Type = Result[1]
|