]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Xml/XmlParser.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Xml / XmlParser.py
index dfc81567aed6d824aa822624aadc9793d91c47f5..82f307b3e5d872f30f1dbd47c4c88b07bdedee82 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
@@ -89,7 +89,7 @@ class DistributionPackageXml(object):
                     DPLicense = DpHeader.GetLicense()[0][1]\r
                 else:\r
                     DPLicense = ''\r
-                \r
+\r
                 CheckDict['Name'] = DpHeader.GetName()\r
                 CheckDict['GUID'] = DpHeader.GetGuid()\r
                 CheckDict['Version'] = DpHeader.GetVersion()\r
@@ -119,7 +119,7 @@ class DistributionPackageXml(object):
                 ValidateMS(self.DistP.ModuleSurfaceArea[Key], ['DistributionPackage', 'ModuleSurfaceArea'])\r
 \r
             #\r
-            # Check Each Tool   \r
+            # Check Each Tool\r
             #\r
             if self.DistP.Tools:\r
                 XmlTreeLevel = ['DistributionPackage', 'Tools', 'Header']\r
@@ -195,7 +195,7 @@ class DistributionPackageXml(object):
                 ModuleKey = (Module.GetGuid(), Module.GetVersion(), Module.GetName(), Module.GetModulePath())\r
                 self.DistP.ModuleSurfaceArea[ModuleKey] = Module\r
 \r
-            #    \r
+            #\r
             # Parse Tools\r
             #\r
             Tmp = MiscellaneousFileXml()\r
@@ -252,7 +252,7 @@ class DistributionPackageXml(object):
                 Msa = ModuleSurfaceAreaXml()\r
                 DomModule = Msa.ToXml(Module)\r
                 Root.appendChild(DomModule)\r
-            #    \r
+            #\r
             # Parse Tools\r
             #\r
             Tmp = MiscellaneousFileXml()\r
@@ -307,7 +307,7 @@ class DistributionPackageXml(object):
 \r
             #\r
             # Remove SupModList="COMMON" or "common"\r
-            #            \r
+            #\r
             XmlContent = \\r
             re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'\r
             '[\s\r\n]*"', '', XmlContent)\r
@@ -324,7 +324,7 @@ class DistributionPackageXml(object):
 # Check if any required item is missing in ModuleSurfaceArea\r
 #\r
 # @param Module: The ModuleSurfaceArea to be checked\r
-# @param XmlTreeLevel: The top level of Module \r
+# @param XmlTreeLevel: The top level of Module\r
 #\r
 def ValidateMS(Module, TopXmlTreeLevel):\r
     ValidateMS1(Module, TopXmlTreeLevel)\r
@@ -336,7 +336,7 @@ def ValidateMS(Module, TopXmlTreeLevel):
 # Check if any required item is missing in ModuleSurfaceArea\r
 #\r
 # @param Module: The ModuleSurfaceArea to be checked\r
-# @param XmlTreeLevel: The top level of Module \r
+# @param XmlTreeLevel: The top level of Module\r
 #\r
 def ValidateMS1(Module, TopXmlTreeLevel):\r
     #\r
@@ -421,10 +421,10 @@ def ValidateMS1(Module, TopXmlTreeLevel):
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
     #\r
-    # If SupArchList is used to identify different EntryPoint, UnloadImage, Constructor/Destructor elements and \r
+    # If SupArchList is used to identify different EntryPoint, UnloadImage, Constructor/Destructor elements and\r
     # that SupArchList does not match ModuleSurfaceArea.ModuleProperties:SupArchList, the tool must exit gracefully,\r
-    # informing the user that the EDK II Build system does not support different EntryPoint, UnloadImage, \r
-    # Constructor or Destructor elements based on Architecture type.  Two SupArchList attributes are considered \r
+    # informing the user that the EDK II Build system does not support different EntryPoint, UnloadImage,\r
+    # Constructor or Destructor elements based on Architecture type.  Two SupArchList attributes are considered\r
     # identical if it lists the same CPU architectures in any order.\r
     #\r
     for Item in Module.GetExternList():\r
@@ -459,7 +459,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
 # Check if any required item is missing in ModuleSurfaceArea\r
 #\r
 # @param Module: The ModuleSurfaceArea to be checked\r
-# @param XmlTreeLevel: The top level of Module \r
+# @param XmlTreeLevel: The top level of Module\r
 #\r
 def ValidateMS2(Module, TopXmlTreeLevel):\r
     #\r
@@ -485,7 +485,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
         Logger.Error("UPT", FORMAT_INVALID, ERR_FILE_NAME_INVALIDE % Module.GetModulePath())\r
 \r
     #\r
-    # Check ModuleProperties->BootMode \r
+    # Check ModuleProperties->BootMode\r
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['ModuleProperties'] + ['BootMode']\r
     for Item in Module.GetBootModeList():\r
@@ -494,7 +494,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
         IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
     #\r
-    # Check ModuleProperties->Event \r
+    # Check ModuleProperties->Event\r
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['ModuleProperties'] + ['Event']\r
     for Item in Module.GetEventList():\r
@@ -503,7 +503,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
         IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
     #\r
-    # Check ModuleProperties->Hob \r
+    # Check ModuleProperties->Hob\r
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['ModuleProperties'] + ['HOB']\r
     for Item in Module.GetHobList():\r
@@ -512,8 +512,8 @@ def ValidateMS2(Module, TopXmlTreeLevel):
         IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
     #\r
-    # The UDP Specification supports the module type of UEFI_RUNTIME_DRIVER, which is not present in the EDK II INF \r
-    # File Specification v. 1.23, so UPT must perform the following translation that include the generation of a \r
+    # The UDP Specification supports the module type of UEFI_RUNTIME_DRIVER, which is not present in the EDK II INF\r
+    # File Specification v. 1.23, so UPT must perform the following translation that include the generation of a\r
     # [Depex] section.\r
     #\r
     if Module.ModuleType == "UEFI_RUNTIME_DRIVER":\r
@@ -549,7 +549,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
                      'Usage':Item.GetUsage()}\r
         IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
         #\r
-        # If the LibraryClass:SupModList is not "UNDEFINED" the LIBRARY_CLASS entry must have the list \r
+        # If the LibraryClass:SupModList is not "UNDEFINED" the LIBRARY_CLASS entry must have the list\r
         # appended using the format:\r
         # LIBRARY_CLASS = <ClassName> ["|" <Edk2ModuleTypeList>]\r
         #\r
@@ -574,10 +574,10 @@ def ValidateMS2(Module, TopXmlTreeLevel):
 \r
 \r
     #\r
-    # For Library modules (indicated by a LIBRARY_CLASS statement in the [Defines] section)                  \r
-    # If the SupModList attribute of the CONSTRUCTOR or DESTRUCTOR element does not match the Supported Module \r
-    # Types listed after "LIBRARY_CLASS = <Keyword> |", the tool should gracefully exit with an error message \r
-    # stating that there is a conflict in the module types the CONSTRUCTOR/DESTRUCTOR is to be used with and \r
+    # For Library modules (indicated by a LIBRARY_CLASS statement in the [Defines] section)\r
+    # If the SupModList attribute of the CONSTRUCTOR or DESTRUCTOR element does not match the Supported Module\r
+    # Types listed after "LIBRARY_CLASS = <Keyword> |", the tool should gracefully exit with an error message\r
+    # stating that there is a conflict in the module types the CONSTRUCTOR/DESTRUCTOR is to be used with and\r
     # the Module types this Library supports.\r
     #\r
     if IsLibraryModule:\r
@@ -591,10 +591,10 @@ def ValidateMS2(Module, TopXmlTreeLevel):
                          RaiseError=True)\r
 \r
     #\r
-    # If the module is not a library module, the MODULE_TYPE listed in the ModuleSurfaceArea.Header must match the \r
-    # SupModList attribute.  If these conditions cannot be met, the tool must exit gracefully, informing the user \r
+    # If the module is not a library module, the MODULE_TYPE listed in the ModuleSurfaceArea.Header must match the\r
+    # SupModList attribute.  If these conditions cannot be met, the tool must exit gracefully, informing the user\r
     # that the EDK II Build system does not currently support the features required by this Module.\r
-    #                   \r
+    #\r
     if not IsLibraryModule:\r
         for Item in Module.GetExternList():\r
             if hasattr(Item, 'SupModList') and len(Item.SupModList) > 0 and \\r
@@ -628,7 +628,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
 # Check if any required item is missing in ModuleSurfaceArea\r
 #\r
 # @param Module: The ModuleSurfaceArea to be checked\r
-# @param XmlTreeLevel: The top level of Module \r
+# @param XmlTreeLevel: The top level of Module\r
 #\r
 def ValidateMS3(Module, TopXmlTreeLevel):\r
     #\r
@@ -666,12 +666,12 @@ def ValidateMS3(Module, TopXmlTreeLevel):
         for AsBuilt in Item.GetAsBuiltList():\r
             #\r
             # Check LibInstance\r
-            #                        \r
+            #\r
             if len(AsBuilt.LibraryInstancesList) == 1 and not AsBuilt.LibraryInstancesList[0]:\r
                 CheckDict = {'GUID':''}\r
                 XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles', 'BinaryFile', 'AsBuilt', 'LibraryInstances']\r
                 IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
-                            \r
+\r
             for LibItem in AsBuilt.LibraryInstancesList:\r
                 CheckDict = {'Guid':LibItem.Guid,\r
                              'Version':LibItem.Version}\r
@@ -925,7 +925,7 @@ def ValidatePS2(Package):
 #\r
 # Check if any required item is missing in  PackageSurfaceArea\r
 #\r
-# @param Package: The PackageSurfaceArea to be checked \r
+# @param Package: The PackageSurfaceArea to be checked\r
 #\r
 def ValidatePackageSurfaceArea(Package):\r
     ValidatePS1(Package)\r