]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Eot/FvImage.py
BaseTools: use set instead of list for a variable to be used with in
[mirror_edk2.git] / BaseTools / Source / Python / Eot / FvImage.py
index 0f742c7d86c277d7a39f363ca4e4792bd7f38248..472ae400506d510a19cc42fa48896fda7aa503ec 100644 (file)
@@ -52,7 +52,7 @@ class Image(array):
         return array.__new__(cls, 'B')\r
 \r
     def __init__(m, ID=None):\r
-        if ID == None:\r
+        if ID is None:\r
             m._ID_ = str(uuid.uuid1()).upper()\r
         else:\r
             m._ID_ = ID\r
@@ -138,7 +138,6 @@ class FirmwareVolume(Image):
         self.FfsDict = sdict()\r
         self.OrderedFfsDict = sdict()\r
         self.UnDispatchedFfsDict = sdict()\r
-        self.NoDepexFfsDict = sdict()\r
         self.ProtocolList = sdict()\r
 \r
     def CheckArchProtocol(self):\r
@@ -208,7 +207,7 @@ class FirmwareVolume(Image):
         return (CouldBeLoaded, DepexString, FileDepex)\r
 \r
     def Dispatch(self, Db = None):\r
-        if Db == None:\r
+        if Db is None:\r
             return False\r
         self.UnDispatchedFfsDict = copy.copy(self.FfsDict)\r
         # Find PeiCore, DexCore, PeiPriori, DxePriori first\r
@@ -236,15 +235,15 @@ class FirmwareVolume(Image):
                 continue\r
 \r
         # Parse SEC_CORE first\r
-        if FfsSecCoreGuid != None:\r
+        if FfsSecCoreGuid is not None:\r
             self.OrderedFfsDict[FfsSecCoreGuid] = self.UnDispatchedFfsDict.pop(FfsSecCoreGuid)\r
             self.LoadPpi(Db, FfsSecCoreGuid)\r
 \r
         # Parse PEI first\r
-        if FfsPeiCoreGuid != None:\r
+        if FfsPeiCoreGuid is not None:\r
             self.OrderedFfsDict[FfsPeiCoreGuid] = self.UnDispatchedFfsDict.pop(FfsPeiCoreGuid)\r
             self.LoadPpi(Db, FfsPeiCoreGuid)\r
-            if FfsPeiPrioriGuid != None:\r
+            if FfsPeiPrioriGuid is not None:\r
                 # Load PEIM described in priori file\r
                 FfsPeiPriori = self.UnDispatchedFfsDict.pop(FfsPeiPrioriGuid)\r
                 if len(FfsPeiPriori.Sections) == 1:\r
@@ -263,10 +262,10 @@ class FirmwareVolume(Image):
         self.DisPatchPei(Db)\r
 \r
         # Parse DXE then\r
-        if FfsDxeCoreGuid != None:\r
+        if FfsDxeCoreGuid is not None:\r
             self.OrderedFfsDict[FfsDxeCoreGuid] = self.UnDispatchedFfsDict.pop(FfsDxeCoreGuid)\r
             self.LoadProtocol(Db, FfsDxeCoreGuid)\r
-            if FfsDxePrioriGuid != None:\r
+            if FfsDxePrioriGuid is not None:\r
                 # Load PEIM described in priori file\r
                 FfsDxePriori = self.UnDispatchedFfsDict.pop(FfsDxePrioriGuid)\r
                 if len(FfsDxePriori.Sections) == 1:\r
@@ -284,26 +283,6 @@ class FirmwareVolume(Image):
 \r
         self.DisPatchDxe(Db)\r
 \r
-    def DisPatchNoDepexFfs(self, Db):\r
-        # Last Load Drivers without Depex\r
-        for FfsID in self.NoDepexFfsDict:\r
-            NewFfs = self.NoDepexFfsDict.pop(FfsID)\r
-            self.OrderedFfsDict[FfsID] = NewFfs\r
-            self.LoadProtocol(Db, FfsID)\r
-\r
-        return True\r
-\r
-    def LoadCallbackProtocol(self):\r
-        IsLoad = True\r
-        for Protocol in self.ProtocolList:\r
-            for Callback in self.ProtocolList[Protocol][1]:\r
-                if Callback[0] not in self.OrderedFfsDict.keys():\r
-                    IsLoad = False\r
-                    continue\r
-            if IsLoad:\r
-                EotGlobalData.gProtocolList[Protocol.lower()] = self.ProtocolList[Protocol][0]\r
-                self.ProtocolList.pop(Protocol)\r
-\r
     def LoadProtocol(self, Db, ModuleGuid):\r
         SqlCommand = """select GuidValue from Report\r
                         where SourceFileFullPath in\r
@@ -383,7 +362,7 @@ class FirmwareVolume(Image):
                     IsInstalled = True\r
                     NewFfs = self.UnDispatchedFfsDict.pop(FfsID)\r
                     NewFfs.Depex = DepexString\r
-                    if FileDepex != None:\r
+                    if FileDepex is not None:\r
                         ScheduleList.insert.insert(FileDepex[1], FfsID, NewFfs, FileDepex[0])\r
                     else:\r
                         ScheduleList[FfsID] = NewFfs\r
@@ -471,7 +450,7 @@ class FirmwareVolume(Image):
             FfsId = repr(FfsObj)\r
             if ((self.Attributes & 0x00000800) != 0 and len(FfsObj) == 0xFFFFFF) \\r
                 or ((self.Attributes & 0x00000800) == 0 and len(FfsObj) == 0):\r
-                if LastFfsObj != None:\r
+                if LastFfsObj is not None:\r
                     LastFfsObj.FreeSpace = EndOfFv - LastFfsObj._OFF_ - len(LastFfsObj)\r
             else:\r
                 if FfsId in self.FfsDict:\r
@@ -480,7 +459,7 @@ class FirmwareVolume(Image):
                                     % (FfsObj.Guid, FfsObj.Offset,\r
                                        self.FfsDict[FfsId].Guid, self.FfsDict[FfsId].Offset))\r
                 self.FfsDict[FfsId] = FfsObj\r
-                if LastFfsObj != None:\r
+                if LastFfsObj is not None:\r
                     LastFfsObj.FreeSpace = FfsStartAddress - LastFfsObj._OFF_ - len(LastFfsObj)\r
 \r
             FfsStartAddress += len(FfsObj)\r
@@ -527,11 +506,11 @@ class CompressedImage(Image):
 \r
     def __init__(m, CompressedData=None, CompressionType=None, UncompressedLength=None):\r
         Image.__init__(m)\r
-        if UncompressedLength != None:\r
+        if UncompressedLength is not None:\r
             m.UncompressedLength = UncompressedLength\r
-        if CompressionType != None:\r
+        if CompressionType is not None:\r
             m.CompressionType = CompressionType\r
-        if CompressedData != None:\r
+        if CompressedData is not None:\r
             m.Data = CompressedData\r
 \r
     def __str__(m):\r
@@ -607,13 +586,13 @@ class GuidDefinedImage(Image):
 \r
     def __init__(m, SectionDefinitionGuid=None, DataOffset=None, Attributes=None, Data=None):\r
         Image.__init__(m)\r
-        if SectionDefinitionGuid != None:\r
+        if SectionDefinitionGuid is not None:\r
             m.SectionDefinitionGuid = SectionDefinitionGuid\r
-        if DataOffset != None:\r
+        if DataOffset is not None:\r
             m.DataOffset = DataOffset\r
-        if Attributes != None:\r
+        if Attributes is not None:\r
             m.Attributes = Attributes\r
-        if Data != None:\r
+        if Data is not None:\r
             m.Data = Data\r
 \r
     def __str__(m):\r
@@ -791,7 +770,7 @@ class Depex(Image):
                 else:\r
                     CurrentData = m._OPCODE_\r
                 m._ExprList.append(Token)\r
-                if CurrentData == None:\r
+                if CurrentData is None:\r
                     break\r
         return m._ExprList\r
 \r
@@ -867,9 +846,9 @@ class Section(Image):
     def __init__(m, Type=None, Size=None):\r
         Image.__init__(m)\r
         m._Alignment = 1\r
-        if Type != None:\r
+        if Type is not None:\r
             m.Type = Type\r
-        if Size != None:\r
+        if Size is not None:\r
             m.Size = Size\r
 \r
     def __str__(m):\r
@@ -1283,7 +1262,7 @@ class LinkMap:
             for Line in MapFile:\r
                 Line = Line.strip()\r
                 if not MappingStart:\r
-                    if MappingTitle.match(Line) != None:\r
+                    if MappingTitle.match(Line) is not None:\r
                         MappingStart = True\r
                     continue\r
                 ResultList = MappingFormat.findall(Line)\r