]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py
BaseTools: Various typo
[mirror_edk2.git] / BaseTools / Source / Python / UPT / PomAdapter / InfPomAlignment.py
index 165ac111272a23a6da56c7d4c3c4900bf3936106..d01481727b9e7d5033a40de607c5663867558df6 100644 (file)
@@ -1,11 +1,11 @@
 ## @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
@@ -20,10 +20,10 @@ InfPomAlignment
 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
@@ -59,8 +59,8 @@ from Common.MultipleWorkspace import MultipleWorkspace as mws
 #\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
@@ -90,12 +90,12 @@ class InfPomAlignment(ModuleObject):
             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
@@ -133,7 +133,7 @@ class InfPomAlignment(ModuleObject):
         #\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
@@ -144,8 +144,8 @@ class InfPomAlignment(ModuleObject):
         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
@@ -184,7 +184,7 @@ class InfPomAlignment(ModuleObject):
 \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
@@ -194,7 +194,7 @@ class InfPomAlignment(ModuleObject):
             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
@@ -248,7 +248,7 @@ class InfPomAlignment(ModuleObject):
                 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
@@ -283,7 +283,7 @@ class InfPomAlignment(ModuleObject):
         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
@@ -293,7 +293,7 @@ class InfPomAlignment(ModuleObject):
             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
@@ -356,13 +356,13 @@ class InfPomAlignment(ModuleObject):
             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
@@ -373,7 +373,7 @@ class InfPomAlignment(ModuleObject):
             Image = ExternObject()\r
             #\r
             # Future enhancement\r
-            #                  \r
+            #\r
             Image.SetConstructor(ConstructorItem.GetCName())\r
             self.SetExternList(self.GetExternList() + [Image])\r
         #\r
@@ -384,7 +384,7 @@ class InfPomAlignment(ModuleObject):
             Image = ExternObject()\r
             #\r
             # Future enhancement\r
-            #                \r
+            #\r
             Image.SetDestructor(DestructorItem.GetCName())\r
             self.SetExternList(self.GetExternList() + [Image])\r
 \r
@@ -611,8 +611,7 @@ class InfPomAlignment(ModuleObject):
                 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
@@ -640,7 +639,7 @@ class InfPomAlignment(ModuleObject):
                 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
@@ -654,11 +653,11 @@ class InfPomAlignment(ModuleObject):
                 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
@@ -685,7 +684,7 @@ class InfPomAlignment(ModuleObject):
             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
@@ -803,7 +802,7 @@ class InfPomAlignment(ModuleObject):
         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
@@ -828,7 +827,7 @@ class InfPomAlignment(ModuleObject):
 \r
         #\r
         # BuildOption AsBuild Info\r
-        #            \r
+        #\r
         for BuildOptionItem in self.Parser.InfBuildOptionSection.GetBuildOptions():\r
             AsBuildBuildOptionList.append(BuildOptionItem)\r
         AsBuildIns.SetBuildFlagsList(AsBuildBuildOptionList)\r
@@ -850,14 +849,14 @@ class InfPomAlignment(ModuleObject):
                 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
@@ -865,7 +864,7 @@ class InfPomAlignment(ModuleObject):
                                                                        self.GetSupArchList(),\r
                                                                        self.BinaryModule,\r
                                                                        DecObjList)\r
-                \r
+\r
         BinariesDict2 = {}\r
         for Key in BinariesDict:\r
             ValueList = BinariesDict[Key]\r
@@ -873,7 +872,7 @@ class InfPomAlignment(ModuleObject):
                 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
@@ -1001,7 +1000,7 @@ class InfPomAlignment(ModuleObject):
                                 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
@@ -1069,10 +1068,10 @@ class InfPomAlignment(ModuleObject):
                     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