]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Library/CommentParsing.py
BaseTools/UPT:merge UPT Tool use Python2 and Python3
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Library / CommentParsing.py
index 285812c9c2f8465674e077449339333e8ff69480..a09a530ffb05251f34ce1083e5fd89abb5d42012 100644 (file)
@@ -74,7 +74,7 @@ def ParseHeaderCommentSection(CommentList, FileName = None, IsBinaryHeader = Fal
     # first find the last copyright line\r
     #\r
     Last = 0\r
-    for Index in xrange(len(CommentList)-1, 0, -1):\r
+    for Index in range(len(CommentList)-1, 0, -1):\r
         Line = CommentList[Index][0]\r
         if _IsCopyrightLine(Line):\r
             Last = Index\r
@@ -206,17 +206,15 @@ def ParsePcdErrorCode (Value = None, ContainerFile = None, LineNum = None):
             Base = 16\r
         else:\r
             Base = 10\r
-        ErrorCode = long(Value, Base)\r
+        ErrorCode = int(Value, Base)\r
         if ErrorCode > PCD_ERR_CODE_MAX_SIZE or ErrorCode < 0:\r
             Logger.Error('Parser',\r
                         FORMAT_NOT_SUPPORTED,\r
                         "The format %s of ErrorCode is not valid, should be UNIT32 type or long type" % Value,\r
                         File = ContainerFile,\r
                         Line = LineNum)\r
-        #\r
-        # To delete the tailing 'L'\r
-        #\r
-        return hex(ErrorCode)[:-1]\r
+        ErrorCode = '0x%x' % ErrorCode\r
+        return ErrorCode\r
     except ValueError as XStr:\r
         if XStr:\r
             pass\r