]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Object / Parser / InfBinaryObject.py
index f968beee6081ee601e67ebb5084a385fb060aab6..af5af46ab21dbf272d89210b8b99f76b7957580b 100644 (file)
@@ -1,12 +1,12 @@
 ## @file\r
-# This file is used to define class objects of INF file [Binaries] section. \r
-# It will consumed by InfParser. \r
+# This file is used to define class objects of INF file [Binaries] section.\r
+# It will consumed by InfParser.\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
@@ -117,7 +117,7 @@ class InfBianryCommonItem(InfBianryItem, CurrentLine):
         self.Family = Family\r
     def GetFamily(self):\r
         return self.Family\r
-    \r
+\r
     def SetGuidValue(self, GuidValue):\r
         self.GuidValue = GuidValue\r
     def GetGuidValue(self):\r
@@ -228,7 +228,7 @@ class InfBinariesObject(InfSectionCommonDef):
                                  Line=VerCurrentLine.GetLineNo(),\r
                                  ExtraData=VerCurrentLine.GetLineString())\r
                 #\r
-                # Validate Feature Flag Express   \r
+                # Validate Feature Flag Express\r
                 #\r
                 FeatureFlagRtv = IsValidFeatureFlagExp(VerContent[3].\\r
                                                        strip())\r
@@ -246,15 +246,15 @@ class InfBinariesObject(InfSectionCommonDef):
             #\r
             # Determine binary file name duplicate. Follow below rule:\r
             #\r
-            # A binary filename must not be duplicated within \r
-            # a [Binaries] section. A binary filename may appear in \r
-            # multiple architectural [Binaries] sections. A binary \r
-            # filename listed in an architectural [Binaries] section \r
-            # must not be listed in the common architectural \r
+            # A binary filename must not be duplicated within\r
+            # a [Binaries] section. A binary filename may appear in\r
+            # multiple architectural [Binaries] sections. A binary\r
+            # filename listed in an architectural [Binaries] section\r
+            # must not be listed in the common architectural\r
             # [Binaries] section.\r
-            # \r
+            #\r
             # NOTE: This check will not report error now.\r
-            # \r
+            #\r
             for Item in self.Binaries:\r
                 if Item.GetFileName() == InfBianryVerItemObj.GetFileName():\r
                     ItemSupArchList = Item.GetSupArchList()\r
@@ -271,8 +271,8 @@ class InfBinariesObject(InfSectionCommonDef):
                                 #\r
                                 pass\r
 \r
-            if InfBianryVerItemObj != None:\r
-                if self.Binaries.has_key((InfBianryVerItemObj)):\r
+            if InfBianryVerItemObj is not None:\r
+                if (InfBianryVerItemObj) in self.Binaries:\r
                     BinariesList = self.Binaries[InfBianryVerItemObj]\r
                     BinariesList.append((InfBianryVerItemObj, VerComment))\r
                     self.Binaries[InfBianryVerItemObj] = BinariesList\r
@@ -315,7 +315,7 @@ class InfBinariesObject(InfSectionCommonDef):
                                  Line=CurrentLineOfItem.GetLineNo(),\r
                                  ExtraData=CurrentLineOfItem.GetLineString())\r
                     return False\r
-                \r
+\r
             if len(ItemContent) > 7:\r
                 Logger.Error("InfParser",\r
                              ToolError.FORMAT_INVALID,\r
@@ -335,7 +335,7 @@ class InfBinariesObject(InfSectionCommonDef):
                 BinaryFileType = ItemContent[0].strip()\r
                 if BinaryFileType == 'RAW' or BinaryFileType == 'ACPI' or BinaryFileType == 'ASL':\r
                     BinaryFileType = 'BIN'\r
-                    \r
+\r
                 if BinaryFileType not in DT.BINARY_FILE_TYPE_LIST:\r
                     Logger.Error("InfParser",\r
                                  ToolError.FORMAT_INVALID,\r
@@ -344,10 +344,10 @@ class InfBinariesObject(InfSectionCommonDef):
                                  File=CurrentLineOfItem.GetFileName(),\r
                                  Line=CurrentLineOfItem.GetLineNo(),\r
                                  ExtraData=CurrentLineOfItem.GetLineString())\r
-                    \r
+\r
                 if BinaryFileType == 'SUBTYPE_GUID':\r
                     BinaryFileType = 'FREEFORM'\r
-                    \r
+\r
                 if BinaryFileType == 'LIB' or BinaryFileType == 'UEFI_APP':\r
                     Logger.Error("InfParser",\r
                                  ToolError.FORMAT_INVALID,\r
@@ -407,7 +407,7 @@ class InfBinariesObject(InfSectionCommonDef):
                 #\r
                 if BinaryFileType != 'FREEFORM':\r
                     InfBianryCommonItemObj.SetTarget(ItemContent[2])\r
-                    \r
+\r
             if len(ItemContent) >= 4:\r
                 #\r
                 # Add Family information\r
@@ -416,13 +416,13 @@ class InfBinariesObject(InfSectionCommonDef):
                     InfBianryCommonItemObj.SetFamily(ItemContent[3])\r
                 else:\r
                     InfBianryCommonItemObj.SetTarget(ItemContent[3])\r
-                    \r
+\r
             if len(ItemContent) >= 5:\r
                 #\r
-                # TagName entries are build system specific. If there \r
-                # is content in the entry, the tool must exit \r
+                # TagName entries are build system specific. If there\r
+                # is content in the entry, the tool must exit\r
                 # gracefully with an error message that indicates build\r
-                # system specific content cannot be distributed using \r
+                # system specific content cannot be distributed using\r
                 # the UDP\r
                 #\r
                 if BinaryFileType != 'FREEFORM':\r
@@ -435,7 +435,7 @@ class InfBinariesObject(InfSectionCommonDef):
                                      ExtraData=CurrentLineOfItem.GetLineString())\r
                 else:\r
                     InfBianryCommonItemObj.SetFamily(ItemContent[4])\r
-                    \r
+\r
             if len(ItemContent) >= 6:\r
                 #\r
                 # Add FeatureFlagExp\r
@@ -449,7 +449,7 @@ class InfBinariesObject(InfSectionCommonDef):
                                      Line=CurrentLineOfItem.GetLineNo(),\r
                                      ExtraData=CurrentLineOfItem.GetLineString())\r
                     #\r
-                    # Validate Feature Flag Express   \r
+                    # Validate Feature Flag Express\r
                     #\r
                     FeatureFlagRtv = IsValidFeatureFlagExp(ItemContent[5].strip())\r
                     if not FeatureFlagRtv[0]:\r
@@ -468,7 +468,7 @@ class InfBinariesObject(InfSectionCommonDef):
                                      File=CurrentLineOfItem.GetFileName(),\r
                                      Line=CurrentLineOfItem.GetLineNo(),\r
                                      ExtraData=CurrentLineOfItem.GetLineString())\r
-                        \r
+\r
             if len(ItemContent) == 7:\r
                 if ItemContent[6].strip() == '':\r
                     Logger.Error("InfParser",\r
@@ -478,7 +478,7 @@ class InfBinariesObject(InfSectionCommonDef):
                                      Line=CurrentLineOfItem.GetLineNo(),\r
                                      ExtraData=CurrentLineOfItem.GetLineString())\r
                 #\r
-                # Validate Feature Flag Express   \r
+                # Validate Feature Flag Express\r
                 #\r
                 FeatureFlagRtv = IsValidFeatureFlagExp(ItemContent[6].strip())\r
                 if not FeatureFlagRtv[0]:\r
@@ -495,15 +495,15 @@ class InfBinariesObject(InfSectionCommonDef):
             #\r
             # Determine binary file name duplicate. Follow below rule:\r
             #\r
-            # A binary filename must not be duplicated within \r
-            # a [Binaries] section. A binary filename may appear in \r
-            # multiple architectural [Binaries] sections. A binary \r
-            # filename listed in an architectural [Binaries] section \r
-            # must not be listed in the common architectural \r
+            # A binary filename must not be duplicated within\r
+            # a [Binaries] section. A binary filename may appear in\r
+            # multiple architectural [Binaries] sections. A binary\r
+            # filename listed in an architectural [Binaries] section\r
+            # must not be listed in the common architectural\r
             # [Binaries] section.\r
-            # \r
+            #\r
             # NOTE: This check will not report error now.\r
-            # \r
+            #\r
 #            for Item in self.Binaries:\r
 #                if Item.GetFileName() == InfBianryCommonItemObj.GetFileName():\r
 #                    ItemSupArchList = Item.GetSupArchList()\r
@@ -521,8 +521,8 @@ class InfBinariesObject(InfSectionCommonDef):
 #                                #\r
 #                                pass\r
 \r
-            if InfBianryCommonItemObj != None:\r
-                if self.Binaries.has_key((InfBianryCommonItemObj)):\r
+            if InfBianryCommonItemObj is not None:\r
+                if (InfBianryCommonItemObj) in self.Binaries:\r
                     BinariesList = self.Binaries[InfBianryCommonItemObj]\r
                     BinariesList.append((InfBianryCommonItemObj, ItemComment))\r
                     self.Binaries[InfBianryCommonItemObj] = BinariesList\r
@@ -537,16 +537,16 @@ class InfBinariesObject(InfSectionCommonDef):
         for ArchItem in ArchList:\r
             #\r
             # Validate Arch\r
-            #            \r
-            if (ArchItem == '' or ArchItem == None):\r
+            #\r
+            if (ArchItem == '' or ArchItem is None):\r
                 ArchItem = 'COMMON'\r
             __SupArchList.append(ArchItem)\r
 \r
-        if UiInf != None:\r
+        if UiInf is not None:\r
             if len(UiInf) > 0:\r
                 #\r
                 # Check UI\r
-                #                    \r
+                #\r
                 for UiItem in UiInf:\r
                     IsValidFileFlag = False\r
                     InfBianryUiItemObj = None\r
@@ -630,7 +630,7 @@ class InfBinariesObject(InfSectionCommonDef):
                                          Line=UiCurrentLine.GetLineNo(),\r
                                          ExtraData=UiCurrentLine.GetLineString())\r
                         #\r
-                        # Validate Feature Flag Express   \r
+                        # Validate Feature Flag Express\r
                         #\r
                         FeatureFlagRtv = IsValidFeatureFlagExp(UiContent[3].strip())\r
                         if not FeatureFlagRtv[0]:\r
@@ -647,15 +647,15 @@ class InfBinariesObject(InfSectionCommonDef):
                     #\r
                     # Determine binary file name duplicate. Follow below rule:\r
                     #\r
-                    # A binary filename must not be duplicated within \r
-                    # a [Binaries] section. A binary filename may appear in \r
-                    # multiple architectural [Binaries] sections. A binary \r
-                    # filename listed in an architectural [Binaries] section \r
-                    # must not be listed in the common architectural \r
+                    # A binary filename must not be duplicated within\r
+                    # a [Binaries] section. A binary filename may appear in\r
+                    # multiple architectural [Binaries] sections. A binary\r
+                    # filename listed in an architectural [Binaries] section\r
+                    # must not be listed in the common architectural\r
                     # [Binaries] section.\r
-                    # \r
+                    #\r
                     # NOTE: This check will not report error now.\r
-                    # \r
+                    #\r
 #                    for Item in self.Binaries:\r
 #                        if Item.GetFileName() == InfBianryUiItemObj.GetFileName():\r
 #                            ItemSupArchList = Item.GetSupArchList()\r
@@ -672,8 +672,8 @@ class InfBinariesObject(InfSectionCommonDef):
 #                                        #\r
 #                                        pass\r
 \r
-                    if InfBianryUiItemObj != None:\r
-                        if self.Binaries.has_key((InfBianryUiItemObj)):\r
+                    if InfBianryUiItemObj is not None:\r
+                        if (InfBianryUiItemObj) in self.Binaries:\r
                             BinariesList = self.Binaries[InfBianryUiItemObj]\r
                             BinariesList.append((InfBianryUiItemObj, UiComment))\r
                             self.Binaries[InfBianryUiItemObj] = BinariesList\r
@@ -681,7 +681,7 @@ class InfBinariesObject(InfSectionCommonDef):
                             BinariesList = []\r
                             BinariesList.append((InfBianryUiItemObj, UiComment))\r
                             self.Binaries[InfBianryUiItemObj] = BinariesList\r
-        if Ver != None and len(Ver) > 0:\r
+        if Ver is not None and len(Ver) > 0:\r
             self.CheckVer(Ver, __SupArchList)\r
         if CommonBinary and len(CommonBinary) > 0:\r
             self.ParseCommonBinary(CommonBinary, __SupArchList)\r