## @file InfPomAlignment.py\r
# This file contained the adapter for convert INF parser object to POM Object\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
import os.path\r
from Logger import StringTable as ST\r
import Logger.Log as Logger\r
-from Library.String import FORMAT_INVALID\r
-from Library.String import PARSER_ERROR\r
-from Library.String import NormPath\r
-from Library.String import GetSplitValueList\r
+from Library.StringUtils import FORMAT_INVALID\r
+from Library.StringUtils import PARSER_ERROR\r
+from Library.StringUtils import NormPath\r
+from Library.StringUtils import GetSplitValueList\r
from Library.Misc import ConvertVersionToDecimal\r
from Library.Misc import GetHelpStringByRemoveHashKey\r
from Library.Misc import ConvertArchList\r
#\r
class InfPomAlignment(ModuleObject):\r
## Construct of InfPomAlignment\r
- # Skip means that UPT don't care the syntax of INF, this may be the not \r
- # distributed INF files during creation or the INF files checked for \r
+ # Skip means that UPT don't care the syntax of INF, this may be the not\r
+ # distributed INF files during creation or the INF files checked for\r
# dependency rule during remove.\r
#\r
def __init__(self, FileName, WorkSpace=None, PackagePath='', Skip=False):\r
self._GenInfPomObjects(Skip)\r
\r
##\r
- # Generate all POM objects, the original input comes \r
+ # Generate all POM objects, the original input comes\r
# from INF parser's output\r
#\r
def _GenInfPomObjects(self, Skip):\r
#\r
- # Call INF Parser to get information from INF file \r
+ # Call INF Parser to get information from INF file\r
#\r
self.Parser = InfParser.InfParser(self.FileName, self.WorkSpace)\r
self.FullPath = self.Parser.FullPath\r
#\r
# Should only have one ArchString Item.\r
#\r
- ArchString = RecordSet.keys()[0]\r
+ ArchString = list(RecordSet.keys())[0]\r
ArchList = GetSplitValueList(ArchString, ' ')\r
ArchList = ConvertArchList(ArchList)\r
HasCalledFlag = False\r
self.SetFileName(self.FileName)\r
self.SetFullPath(self.FullPath)\r
#\r
- # The INF's filename (without the directory path or the extension) \r
- # must be used for the value of the \r
+ # The INF's filename (without the directory path or the extension)\r
+ # must be used for the value of the\r
# ModuleSurfaceArea.Header.Name element\r
#\r
self.SetName(os.path.splitext(os.path.basename(self.FileName))[0])\r
\r
#\r
# must exist items in INF define section\r
- # MODULE_TYPE/BASE_NAME/INF_VERSION/FILE_GUID/VERSION_STRING \r
+ # MODULE_TYPE/BASE_NAME/INF_VERSION/FILE_GUID/VERSION_STRING\r
#\r
if DefineObj.GetModuleType() is None:\r
Logger.Error("InfParser", FORMAT_INVALID,\r
ModuleType = DefineObj.GetModuleType().GetValue()\r
if ModuleType:\r
#\r
- # Drivers and applications are not allowed to have a MODULE_TYPE of "BASE". Only \r
+ # Drivers and applications are not allowed to have a MODULE_TYPE of "BASE". Only\r
# libraries are permitted to a have a MODULE_TYPE of "BASE".\r
#\r
if len(DefineObj.LibraryClass) == 0 and ModuleType == 'BASE':\r
Logger.Error("Parser", PARSER_ERROR, ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF, ExtraData=self.FullPath,\r
RaiseError=Logger.IS_RAISE_ERROR)\r
#\r
- # if there is Shadow, Should judge the MODULE_TYPE in \r
+ # if there is Shadow, Should judge the MODULE_TYPE in\r
# SEC, PEI_CORE and PEIM\r
#\r
if DefineObj.GetShadow():\r
self._GenSpecialComments()\r
#\r
# put all define statement into user-extension sections\r
- # \r
+ #\r
DefinesDictNew = GenModuleHeaderUserExt(DefineObj, ArchString)\r
if DefinesDictNew:\r
UserExtension = CommonObject.UserExtensionObject()\r
self.SetUserExtensionList(self.GetUserExtensionList() + [UserExtension])\r
#\r
# Get all meta-file header information\r
- # the record is list of items formated: \r
+ # the record is list of items formatted:\r
# [LineValue, Arch, StartLine, ID, Third]\r
#\r
InfHeaderObj = self.Parser.InfHeader\r
self.SetExternList(self.GetExternList() + [Image])\r
#\r
# UNLOAD_IMAGE\r
- # \r
+ #\r
UnloadImageList = DefineObj.GetUnloadImages()\r
for UnloadImage in UnloadImageList:\r
Image = ExternObject()\r
#\r
# Future enhancement\r
- # \r
+ #\r
Image.SetUnloadImage(UnloadImage.GetCName())\r
self.SetExternList(self.GetExternList() + [Image])\r
#\r
Image = ExternObject()\r
#\r
# Future enhancement\r
- # \r
+ #\r
Image.SetConstructor(ConstructorItem.GetCName())\r
self.SetExternList(self.GetExternList() + [Image])\r
#\r
Image = ExternObject()\r
#\r
# Future enhancement\r
- # \r
+ #\r
Image.SetDestructor(DestructorItem.GetCName())\r
self.SetExternList(self.GetExternList() + [Image])\r
\r
SourceFile = Item.GetSourceFileName()\r
Family = Item.GetFamily()\r
FeatureFlag = Item.GetFeatureFlagExp()\r
- SupArchList = ConvertArchList(Item.GetSupArchList())\r
- SupArchList.sort()\r
+ SupArchList = sorted(ConvertArchList(Item.GetSupArchList()))\r
Source = SourceFileObject()\r
Source.SetSourceFile(SourceFile)\r
Source.SetFamily(Family)\r
UserExtension = CommonObject.UserExtensionObject()\r
UserId = UserExtensionDataObj.GetUserId()\r
if UserId.startswith('"') and UserId.endswith('"'):\r
- UserId = UserId[1:-1] \r
+ UserId = UserId[1:-1]\r
UserExtension.SetUserID(UserId)\r
Identifier = UserExtensionDataObj.GetIdString()\r
if Identifier.startswith('"') and Identifier.endswith('"'):\r
UserExtension.SetStatement(UserExtensionDataObj.GetContent())\r
UserExtension.SetSupArchList(ConvertArchList(UserExtensionDataObj.GetSupArchList()))\r
self.SetUserExtensionList(self.GetUserExtensionList() + [UserExtension])\r
- \r
+\r
#\r
# Gen UserExtensions of TianoCore."BinaryHeader"\r
#\r
- \r
+\r
#Get Binary header from INF file\r
BinaryAbstractList = self.BinaryHeaderAbstractList\r
BinaryDescriptionList = self.BinaryHeaderDescriptionList\r
BinaryUserExtension.SetIdentifier(DT.TAB_BINARY_HEADER_IDENTIFIER)\r
BinaryUserExtension.SetUserID(DT.TAB_BINARY_HEADER_USERID)\r
self.SetUserExtensionList(self.GetUserExtensionList() + [BinaryUserExtension])\r
- \r
+\r
def _GenDepexesList(self, SmmDepexList, DxeDepexList, PeiDepexList):\r
if SmmDepexList:\r
self.SetSmmDepex(SmmDepexList)\r
BinaryData = BinaryObj.keys()\r
\r
#\r
- # If the INF file does not contain a [Sources] section, and the INF file does contain a [Binaries] section, \r
+ # If the INF file does not contain a [Sources] section, and the INF file does contain a [Binaries] section,\r
# then the ModuleSurfaceArea.BinaryModule attribute must be set to true. Otherwise, do not use the attribute\r
#\r
if BinaryObj and not self.Parser.InfSourcesSection.GetSources():\r
\r
#\r
# BuildOption AsBuild Info\r
- # \r
+ #\r
for BuildOptionItem in self.Parser.InfBuildOptionSection.GetBuildOptions():\r
AsBuildBuildOptionList.append(BuildOptionItem)\r
AsBuildIns.SetBuildFlagsList(AsBuildBuildOptionList)\r
TempPath = ModulePath\r
ModulePath = os.path.dirname(ModulePath)\r
PackageName = TempPath\r
- DecFilePath = os.path.normpath(os.path.join(WorkSpace, PackageName)) \r
+ DecFilePath = os.path.normpath(os.path.join(WorkSpace, PackageName))\r
if DecFilePath:\r
for File in os.listdir(DecFilePath):\r
if File.upper().endswith('.DEC'):\r
DecFileFullPath = os.path.normpath(os.path.join(DecFilePath, File))\r
DecObjList.append(DecPomAlignment(DecFileFullPath, self.WorkSpace))\r
- \r
- \r
+\r
+\r
BinariesDict, AsBuildIns, BinaryFileObjectList = GenBinaryData(BinaryData, BinaryObj,\r
BinariesDict,\r
AsBuildIns,\r
self.GetSupArchList(),\r
self.BinaryModule,\r
DecObjList)\r
- \r
+\r
BinariesDict2 = {}\r
for Key in BinariesDict:\r
ValueList = BinariesDict[Key]\r
BinariesDict2[Key] = ValueList\r
else:\r
#\r
- # if there is no TagName, ToolCode, HelpStr, \r
+ # if there is no TagName, ToolCode, HelpStr,\r
# then do not need to put them into userextension\r
#\r
(Target, Family, TagName, HelpStr) = ValueList[0]\r
HelpTxtTailObj.SetLang(DT.TAB_LANGUAGE_EN_X)\r
HelpTxtTailObj.SetString(HelpString)\r
ListObject.SetHelpTextList([HelpTxtTailObj])\r
- \r
+\r
GuidProtocolPpiList.append(ListObject)\r
elif Type == DT.TAB_PROTOCOLS:\r
ProtocolData = ProtocolObj.keys()\r
FileObj.SetURI(FileName)\r
MiscFileObj.SetFileList(MiscFileObj.GetFileList()+[FileObj])\r
else:\r
- Logger.Error("InfParser", \r
+ Logger.Error("InfParser",\r
FORMAT_INVALID,\r
ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(Line),\r
File=GlobalData.gINF_MODULE_NAME,\r
- ExtraData=Line) \r
- self.SetMiscFileList(self.GetMiscFileList()+[MiscFileObj]) \r
- \r
+ ExtraData=Line)\r
+ self.SetMiscFileList(self.GetMiscFileList()+[MiscFileObj])\r
+\r