]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Xml/XmlParserMisc.py
BaseTools/UPT: Porting UPT Tool from Python2 to Python3
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Xml / XmlParserMisc.py
index 7e3dc94edf64499473311b921aad74646ad08ec3..bf64d89f17d9ad830f78dfe1f7c0546eb149fd75 100644 (file)
@@ -1,11 +1,11 @@
 ## @file\r
 # This file is used to parse a xml file of .PKG file\r
 #\r
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
-# This program and the accompanying materials are licensed and made available \r
-# under the terms and conditions of the BSD License which accompanies this \r
-# distribution. The full text of the license may be found at \r
+# This program and the accompanying materials are licensed and made available\r
+# under the terms and conditions of the BSD License which accompanies this\r
+# distribution. The full text of the license may be found at\r
 # http://opensource.org/licenses/bsd-license.php\r
 #\r
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
@@ -21,7 +21,7 @@ from Logger.ToolError import PARSER_ERROR
 import Logger.Log as Logger\r
 \r
 ## ConvertVariableName()\r
-# Convert VariableName to be L"string", \r
+# Convert VariableName to be L"string",\r
 # input of UCS-2 format Hex Array or L"string" (C style.) could be converted successfully,\r
 # others will not.\r
 #\r
@@ -31,11 +31,11 @@ import Logger.Log as Logger
 def ConvertVariableName(VariableName):\r
     VariableName = VariableName.strip()\r
     #\r
-    # check for L quoted string \r
+    # check for L quoted string\r
     #\r
     if VariableName.startswith('L"') and VariableName.endswith('"'):\r
         return VariableName\r
-    \r
+\r
     #\r
     # check for Hex Array, it should be little endian even number of hex numbers\r
     #\r
@@ -52,8 +52,8 @@ def ConvertVariableName(VariableName):
         SecondByte = int(ValueList[Index + 1], 16)\r
         if SecondByte != 0:\r
             return None\r
-  \r
-        if FirstByte not in xrange(0x20, 0x7F):\r
+\r
+        if FirstByte not in range(0x20, 0x7F):\r
             return None\r
         TransferedStr += ('%c')%FirstByte\r
         Index = Index + 2\r
@@ -63,10 +63,10 @@ def ConvertVariableName(VariableName):
 ## IsRequiredItemListNull\r
 #\r
 # Check if a required XML section item/attribue is NULL\r
-# \r
+#\r
 # @param ItemList:     The list of items to be checked\r
 # @param XmlTreeLevel: The error message tree level\r
-# \r
+#\r
 def IsRequiredItemListNull(ItemDict, XmlTreeLevel):\r
     for Key in ItemDict:\r
         if not ItemDict[Key]:\r
@@ -74,7 +74,7 @@ def IsRequiredItemListNull(ItemDict, XmlTreeLevel):
             ErrorMsg = ERR_XML_PARSER_REQUIRED_ITEM_MISSING % (Key, Msg)\r
             Logger.Error('\nUPT', PARSER_ERROR, ErrorMsg, RaiseError=True)\r
 \r
-## Get help text \r
+## Get help text\r
 #\r
 # @param HelpText\r
 #\r
@@ -86,8 +86,8 @@ def GetHelpTextList(HelpText):
         HelpTextObj.SetString(HelT.HelpText)\r
         HelpTextList.append(HelpTextObj)\r
     return HelpTextList\r
-    \r
-## Get Prompt text \r
+\r
+## Get Prompt text\r
 #\r
 # @param Prompt\r
 #\r