]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
BaseTools: Fix old python2 idioms
[mirror_edk2.git] / BaseTools / Source / Python / UPT / GenMetaFile / GenInfFile.py
index bfd422b196ba0f6abe977be825d333e9221bdc7f..9457f851f4ec21aac68905e1a1f0f6eeb12e0712 100644 (file)
@@ -438,14 +438,14 @@ def GenLibraryClasses(ModuleObject):
                 Statement = '# Guid: ' + LibraryItem.Guid + ' Version: ' + LibraryItem.Version\r
 \r
                 if len(BinaryFile.SupArchList) == 0:\r
-                    if LibraryClassDict.has_key('COMMON') and Statement not in LibraryClassDict['COMMON']:\r
+                    if 'COMMON' in LibraryClassDict and Statement not in LibraryClassDict['COMMON']:\r
                         LibraryClassDict['COMMON'].append(Statement)\r
                     else:\r
                         LibraryClassDict['COMMON'] = ['## @LIB_INSTANCES']\r
                         LibraryClassDict['COMMON'].append(Statement)\r
                 else:\r
                     for Arch in BinaryFile.SupArchList:\r
-                        if LibraryClassDict.has_key(Arch):\r
+                        if Arch in LibraryClassDict:\r
                             if Statement not in LibraryClassDict[Arch]:\r
                                 LibraryClassDict[Arch].append(Statement)\r
                             else:\r
@@ -493,8 +493,7 @@ def GenPackages(ModuleObject):
         Statement += RelaPath.replace('\\', '/')\r
         if FFE:\r
             Statement += '|' + FFE\r
-        ArchList = PackageDependency.GetSupArchList()\r
-        ArchList.sort()\r
+        ArchList = sorted(PackageDependency.GetSupArchList())\r
         SortedArch = ' '.join(ArchList)\r
         if SortedArch in NewSectionDict:\r
             NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]\r
@@ -513,8 +512,7 @@ def GenSources(ModuleObject):
         SourceFile = Source.GetSourceFile()\r
         Family = Source.GetFamily()\r
         FeatureFlag = Source.GetFeatureFlag()\r
-        SupArchList = Source.GetSupArchList()\r
-        SupArchList.sort()\r
+        SupArchList = sorted(Source.GetSupArchList())\r
         SortedArch = ' '.join(SupArchList)\r
         Statement = GenSourceStatement(ConvertPath(SourceFile), Family, FeatureFlag)\r
         if SortedArch in NewSectionDict:\r
@@ -722,8 +720,7 @@ def GenGuidSections(GuidObjList):
         #\r
         # merge duplicate items\r
         #\r
-        ArchList = Guid.GetSupArchList()\r
-        ArchList.sort()\r
+        ArchList = sorted(Guid.GetSupArchList())\r
         SortedArch = ' '.join(ArchList)\r
         if (Statement, SortedArch) in GuidDict:\r
             PreviousComment = GuidDict[Statement, SortedArch]\r
@@ -782,8 +779,7 @@ def GenProtocolPPiSections(ObjList, IsProtocol):
         #\r
         # merge duplicate items\r
         #\r
-        ArchList = Object.GetSupArchList()\r
-        ArchList.sort()\r
+        ArchList = sorted(Object.GetSupArchList())\r
         SortedArch = ' '.join(ArchList)\r
         if (Statement, SortedArch) in Dict:\r
             PreviousComment = Dict[Statement, SortedArch]\r
@@ -857,8 +853,7 @@ def GenPcdSections(ModuleObject):
             #\r
             # Merge duplicate entries\r
             #\r
-            ArchList = Pcd.GetSupArchList()\r
-            ArchList.sort()\r
+            ArchList = sorted(Pcd.GetSupArchList())\r
             SortedArch = ' '.join(ArchList)\r
             if (Statement, SortedArch) in Dict:\r
                 PreviousComment = Dict[Statement, SortedArch]\r
@@ -917,14 +912,14 @@ def GenAsBuiltPacthPcdSections(ModuleObject):
             if FileNameObjList:\r
                 ArchList = FileNameObjList[0].GetSupArchList()\r
             if len(ArchList) == 0:\r
-                if PatchPcdDict.has_key(DT.TAB_ARCH_COMMON):\r
+                if DT.TAB_ARCH_COMMON in PatchPcdDict:\r
                     if Statement not in PatchPcdDict[DT.TAB_ARCH_COMMON]:\r
                         PatchPcdDict[DT.TAB_ARCH_COMMON].append(Statement)\r
                 else:\r
                     PatchPcdDict[DT.TAB_ARCH_COMMON] = [Statement]\r
             else:\r
                 for Arch in ArchList:\r
-                    if PatchPcdDict.has_key(Arch):\r
+                    if Arch in PatchPcdDict:\r
                         if Statement not in PatchPcdDict[Arch]:\r
                             PatchPcdDict[Arch].append(Statement)\r
                     else:\r
@@ -967,13 +962,13 @@ def GenAsBuiltPcdExSections(ModuleObject):
                 ArchList = FileNameObjList[0].GetSupArchList()\r
 \r
             if len(ArchList) == 0:\r
-                if PcdExDict.has_key('COMMON'):\r
+                if 'COMMON' in PcdExDict:\r
                     PcdExDict['COMMON'].append(Statement)\r
                 else:\r
                     PcdExDict['COMMON'] = [Statement]\r
             else:\r
                 for Arch in ArchList:\r
-                    if PcdExDict.has_key(Arch):\r
+                    if Arch in PcdExDict:\r
                         if Statement not in PcdExDict[Arch]:\r
                             PcdExDict[Arch].append(Statement)\r
                     else:\r
@@ -1025,8 +1020,7 @@ def GenSpecialSections(ObjectList, SectionName, UserExtensionsContent=''):
         if CommentStr and not CommentStr.endswith('\n#\n'):\r
             CommentStr = CommentStr + '#\n'\r
         NewStateMent = CommentStr + Statement\r
-        SupArch = Obj.GetSupArchList()\r
-        SupArch.sort()\r
+        SupArch = sorted(Obj.GetSupArchList())\r
         SortedArch = ' '.join(SupArch)\r
         if SortedArch in NewSectionDict:\r
             NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [NewStateMent]\r
@@ -1071,7 +1065,7 @@ def GenBuildOptions(ModuleObject):
             for BuilOptionItem in BinaryFile.AsBuiltList[0].BinaryBuildFlagList:\r
                 Statement = '#' + BuilOptionItem.AsBuiltOptionFlags\r
                 if len(BinaryFile.SupArchList) == 0:\r
-                    if BuildOptionDict.has_key('COMMON'):\r
+                    if 'COMMON' in BuildOptionDict:\r
                         if Statement not in BuildOptionDict['COMMON']:\r
                             BuildOptionDict['COMMON'].append(Statement)\r
                     else:\r
@@ -1079,7 +1073,7 @@ def GenBuildOptions(ModuleObject):
                         BuildOptionDict['COMMON'].append(Statement)\r
                 else:\r
                     for Arch in BinaryFile.SupArchList:\r
-                        if BuildOptionDict.has_key(Arch):\r
+                        if Arch in BuildOptionDict:\r
                             if Statement not in BuildOptionDict[Arch]:\r
                                 BuildOptionDict[Arch].append(Statement)\r
                         else:\r
@@ -1104,8 +1098,7 @@ def GenBinaries(ModuleObject):
             FileName = ConvertPath(FileNameObj.GetFilename())\r
             FileType = FileNameObj.GetFileType()\r
             FFE = FileNameObj.GetFeatureFlag()\r
-            ArchList = FileNameObj.GetSupArchList()\r
-            ArchList.sort()\r
+            ArchList = sorted(FileNameObj.GetSupArchList())\r
             SortedArch = ' '.join(ArchList)\r
             Key = (FileName, FileType, FFE, SortedArch)\r
             if Key in BinariesDict:\r