## @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
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
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
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
Msa = ModuleSurfaceAreaXml()\r
DomModule = Msa.ToXml(Module)\r
Root.appendChild(DomModule)\r
- # \r
+ #\r
# Parse Tools\r
#\r
Tmp = MiscellaneousFileXml()\r
\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
# 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
# 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
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
# 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
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
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
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
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
'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
\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
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
# 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
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
#\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