]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Xml/XmlParser.py
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Xml / XmlParser.py
index adfeca81a000328412ca8b5aa2949d3d56b807bd..8e22a280f655b62f96bd1f148eac6aa448a1a219 100644 (file)
@@ -1,15 +1,9 @@
 ## @file\r
 # This file is used to parse a xml file of .PKG file\r
 #\r
-# Copyright (c) 2011, 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
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 \r
 '''\r
@@ -38,7 +32,6 @@ from Logger.StringTable import ERR_XML_INVALID_EXTERN_SUPARCHLIST
 from Logger.StringTable import ERR_XML_INVALID_EXTERN_SUPMODLIST\r
 from Logger.StringTable import ERR_XML_INVALID_EXTERN_SUPMODLIST_NOT_LIB\r
 from Logger.StringTable import ERR_FILE_NAME_INVALIDE\r
-from Logger.StringTable import ERR_XML_INVALID_BINARY_FILE_TYPE\r
 from Logger.ToolError import PARSER_ERROR\r
 from Logger.ToolError import FORMAT_INVALID\r
 \r
@@ -78,12 +71,25 @@ class DistributionPackageXml(object):
                 DpHeader = self.DistP.Header\r
                 XmlTreeLevel = ['DistributionPackage', 'DistributionHeader']\r
                 CheckDict = Sdict()\r
+                if DpHeader.GetAbstract():\r
+                    DPAbstract = DpHeader.GetAbstract()[0][1]\r
+                else:\r
+                    DPAbstract = ''\r
+                if DpHeader.GetCopyright():\r
+                    DPCopyright = DpHeader.GetCopyright()[0][1]\r
+                else:\r
+                    DPCopyright = ''\r
+                if DpHeader.GetLicense():\r
+                    DPLicense = DpHeader.GetLicense()[0][1]\r
+                else:\r
+                    DPLicense = ''\r
+\r
                 CheckDict['Name'] = DpHeader.GetName()\r
                 CheckDict['GUID'] = DpHeader.GetGuid()\r
                 CheckDict['Version'] = DpHeader.GetVersion()\r
-                CheckDict['Copyright'] = DpHeader.GetCopyright()\r
-                CheckDict['License'] = DpHeader.GetLicense()\r
-                CheckDict['Abstract'] = DpHeader.GetAbstract()\r
+                CheckDict['Copyright'] = DPCopyright\r
+                CheckDict['License'] = DPLicense\r
+                CheckDict['Abstract'] = DPAbstract\r
                 CheckDict['Vendor'] = DpHeader.GetVendor()\r
                 CheckDict['Date'] = DpHeader.GetDate()\r
                 CheckDict['XmlSpecification'] = DpHeader.GetXmlSpecification()\r
@@ -91,7 +97,7 @@ class DistributionPackageXml(object):
                 IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
             else:\r
                 XmlTreeLevel = ['DistributionPackage', 'DistributionHeader']\r
-                CheckDict = CheckDict = {'DistributionHeader':'', }\r
+                CheckDict = CheckDict = {'DistributionHeader': '', }\r
                 IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
             #\r
@@ -107,20 +113,20 @@ 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
-                CheckDict = {'Name':self.DistP.Tools.GetName(), }\r
+                CheckDict = {'Name': self.DistP.Tools.GetName(), }\r
                 IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
                 if not self.DistP.Tools.GetFileList():\r
                     XmlTreeLevel = ['DistributionPackage', 'Tools']\r
-                    CheckDict = {'FileName':None, }\r
+                    CheckDict = {'FileName': None, }\r
                     IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
                 for Item in self.DistP.Tools.GetFileList():\r
                     XmlTreeLevel = ['DistributionPackage', 'Tools']\r
-                    CheckDict = {'FileName':Item.GetURI(), }\r
+                    CheckDict = {'FileName': Item.GetURI(), }\r
                     IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
             #\r
@@ -128,16 +134,16 @@ class DistributionPackageXml(object):
             #\r
             if self.DistP.MiscellaneousFiles:\r
                 XmlTreeLevel = ['DistributionPackage', 'MiscellaneousFiles', 'Header']\r
-                CheckDict = {'Name':self.DistP.MiscellaneousFiles.GetName(), }\r
+                CheckDict = {'Name': self.DistP.MiscellaneousFiles.GetName(), }\r
                 IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
                 if not self.DistP.MiscellaneousFiles.GetFileList():\r
                     XmlTreeLevel = ['DistributionPackage', 'MiscellaneousFiles']\r
-                    CheckDict = {'FileName':None, }\r
+                    CheckDict = {'FileName': None, }\r
                     IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
                 for Item in self.DistP.MiscellaneousFiles.GetFileList():\r
                     XmlTreeLevel = ['DistributionPackage', 'MiscellaneousFiles']\r
-                    CheckDict = {'FileName':Item.GetURI(), }\r
+                    CheckDict = {'FileName': Item.GetURI(), }\r
                     IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
             #\r
@@ -145,12 +151,12 @@ class DistributionPackageXml(object):
             #\r
             for Item in self.DistP.UserExtensions:\r
                 XmlTreeLevel = ['DistributionPackage', 'UserExtensions']\r
-                CheckDict = {'UserId':Item.GetUserID(), }\r
+                CheckDict = {'UserId': Item.GetUserID(), }\r
                 IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
 \r
     def FromXml(self, Filename=None):\r
-        if Filename != None:\r
+        if Filename is not None:\r
             self.DistP = DistributionPackageClass()\r
             #\r
             # Load to XML\r
@@ -180,8 +186,10 @@ class DistributionPackageXml(object):
             for Item in XmlList(self.Pkg, '/DistributionPackage/ModuleSurfaceArea'):\r
                 Msa = ModuleSurfaceAreaXml()\r
                 Module = Msa.FromXml(Item, 'ModuleSurfaceArea', True)\r
-                self.DistP.ModuleSurfaceArea[(Module.GetGuid(), Module.GetVersion(), Module.GetModulePath())] = Module\r
-            #    \r
+                ModuleKey = (Module.GetGuid(), Module.GetVersion(), Module.GetName(), Module.GetModulePath())\r
+                self.DistP.ModuleSurfaceArea[ModuleKey] = Module\r
+\r
+            #\r
             # Parse Tools\r
             #\r
             Tmp = MiscellaneousFileXml()\r
@@ -213,7 +221,7 @@ class DistributionPackageXml(object):
     def ToXml(self, DistP):\r
         if self.DistP:\r
             pass\r
-        if DistP != None:\r
+        if DistP is not None:\r
             #\r
             # Parse DistributionPackageHeader\r
             #\r
@@ -238,7 +246,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
@@ -293,7 +301,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
@@ -310,7 +318,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
@@ -322,7 +330,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
@@ -330,7 +338,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['Guids']\r
     for Item in Module.GetGuidList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'GuidCName':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -355,7 +363,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['Protocols']\r
     for Item in Module.GetProtocolList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Protocol':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -370,7 +378,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['PPIs']\r
     for Item in Module.GetPpiList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Ppi':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -385,7 +393,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['PcdCoded']\r
     for Item in Module.GetPcdList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'PcdEntry':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -402,15 +410,15 @@ def ValidateMS1(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['Externs']\r
     for Item in Module.GetExternList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Extern':''}\r
             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
@@ -435,17 +443,17 @@ def ValidateMS1(Module, TopXmlTreeLevel):
     XmlTreeLevel = TopXmlTreeLevel + ['MiscellaneousFiles']\r
     for Item in Module.GetMiscFileList():\r
         if not Item.GetFileList():\r
-            CheckDict = {'Filename':'', }\r
+            CheckDict = {'Filename': '', }\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
         for File in Item.GetFileList():\r
-            CheckDict = {'Filename':File.GetURI(), }\r
+            CheckDict = {'Filename': File.GetURI(), }\r
 \r
 ## ValidateMS2\r
 #\r
 # 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
@@ -471,7 +479,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
@@ -480,7 +488,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
@@ -489,7 +497,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
@@ -498,8 +506,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
@@ -522,7 +530,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['LibraryClassDefinitions']\r
     for Item in Module.GetLibraryClassList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'LibraryClass':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -535,7 +543,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
@@ -560,10 +568,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
@@ -577,10 +585,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
@@ -594,7 +602,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['SourceFiles']\r
     for Item in Module.GetSourceFileList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Filename':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -608,18 +616,13 @@ def ValidateMS2(Module, TopXmlTreeLevel):
         if Item and len(Item.FileNamList) > 0 and Item.FileNamList[0].FileType == 'FREEFORM':\r
             Item.FileNamList[0].FileType = 'SUBTYPE_GUID'\r
             Module.GetBinaryFileList()[ItemCount] = Item\r
-        if Item and len(Item.FileNamList) > 0 and Item.FileNamList[0].FileType == 'DISPOSABLE':\r
-            Logger.Error('\nUPT',\r
-                 PARSER_ERROR,\r
-                 ERR_XML_INVALID_BINARY_FILE_TYPE % ('DISPOSABLE'),\r
-                 RaiseError=True)           \r
 \r
 ## ValidateMS3\r
 #\r
 # 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
@@ -627,7 +630,7 @@ def ValidateMS3(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['PackageDependencies']\r
     for Item in Module.GetPackageDependencyList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Package':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -640,7 +643,7 @@ def ValidateMS3(Module, TopXmlTreeLevel):
     # Check BinaryFiles -> BinaryFile\r
     #\r
     for Item in Module.GetBinaryFileList():\r
-        if Item == None:\r
+        if Item is None:\r
             XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles']\r
             CheckDict = {'BinaryFile':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
@@ -657,12 +660,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
@@ -695,8 +698,7 @@ def ValidateMS3(Module, TopXmlTreeLevel):
             for PcdExItem in AsBuilt.PcdExValueList:\r
                 CheckDict = {'TokenSpaceGuidValue':PcdExItem.TokenSpaceGuidValue,\r
                              'Token':PcdExItem.Token,\r
-                             'DatumType':PcdExItem.DatumType,\r
-                             'Value':PcdExItem.DefaultValue}\r
+                             'DatumType':PcdExItem.DatumType}\r
                 XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles', 'BinaryFile', 'AsBuilt', 'PcdExValue']\r
                 IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
                 #\r
@@ -764,7 +766,7 @@ def ValidatePS1(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'ClonedFrom']\r
     for Item in Package.GetClonedFromList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = Sdict()\r
             CheckDict['GUID'] = ''\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
@@ -779,7 +781,7 @@ def ValidatePS1(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'LibraryClassDeclarations']\r
     for Item in Package.GetLibraryClassList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'LibraryClass':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -794,7 +796,7 @@ def ValidatePS1(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'IndustryStandardIncludes']\r
     for Item in Package.GetStandardIncludeFileList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'IndustryStandardHeader':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -808,7 +810,7 @@ def ValidatePS1(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PackageIncludes']\r
     for Item in Package.GetPackageIncludeFileList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'PackageHeader':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -834,7 +836,7 @@ def ValidatePS2(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'GuidDeclarations']\r
     for Item in Package.GetGuidList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Entry':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -849,7 +851,7 @@ def ValidatePS2(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'ProtocolDeclarations']\r
     for Item in Package.GetProtocolList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Entry':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -864,7 +866,7 @@ def ValidatePS2(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PpiDeclarations']\r
     for Item in Package.GetPpiList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Entry':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -879,7 +881,7 @@ def ValidatePS2(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PcdDeclarations']\r
     for Item in Package.GetPcdList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'PcdEntry':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -907,17 +909,17 @@ def ValidatePS2(Package):
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'MiscellaneousFiles']\r
     for Item in Package.GetMiscFileList():\r
         if not Item.GetFileList():\r
-            CheckDict = {'Filename':'', }\r
+            CheckDict = {'Filename': '', }\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
         for File in Item.GetFileList():\r
-            CheckDict = {'Filename':File.GetURI(), }\r
+            CheckDict = {'Filename': File.GetURI(), }\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
 ## ValidatePackageSurfaceArea\r
 #\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