]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py
BaseTools: use built in OrderedDict instead of custom version.
[mirror_edk2.git] / BaseTools / Source / Python / Common / EdkIIWorkspaceBuild.py
index 82ab1796ad53f761156992ebed77a3dd54e7565a..c4f45b7c59c223b1ea354e29b1dcea0573551b84 100644 (file)
@@ -1,8 +1,8 @@
 ## @file\r
 # This file is used to define each component of the build database\r
 #\r
-# Copyright (c) 2007 ~ 2008, Intel Corporation\r
-# All rights reserved. This program and the accompanying materials\r
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
 # http://opensource.org/licenses/bsd-license.php\r
@@ -14,7 +14,7 @@
 ##\r
 # Import Modules\r
 #\r
-import os, string, copy, pdb, copy\r
+import Common.LongFilePathOs as os, string, copy, pdb, copy\r
 import EdkLogger\r
 import DataType\r
 from InfClassObject import *\r
@@ -22,7 +22,7 @@ from DecClassObject import *
 from DscClassObject import *\r
 from String import *\r
 from BuildToolError import *\r
-from Misc import sdict\r
+from collections import OrderedDict\r
 import Database as Database\r
 import time as time\r
 \r
@@ -93,7 +93,7 @@ class PcdClassObject(object):
     # @retval True  The two pcds are the same\r
     #\r
     def __eq__(self, Other):\r
-        return Other != None and self.TokenCName == Other.TokenCName and self.TokenSpaceGuidCName == Other.TokenSpaceGuidCName\r
+        return Other is not None and self.TokenCName == Other.TokenCName and self.TokenSpaceGuidCName == Other.TokenSpaceGuidCName\r
 \r
     ## Override __hash__ function\r
     #\r
@@ -121,7 +121,7 @@ class LibraryClassObject(object):
     def __init__(self, Name = None, SupModList = [], Type = None):\r
         self.LibraryClass = Name\r
         self.SupModList = SupModList\r
-        if Type != None:\r
+        if Type is not None:\r
             self.SupModList = CleanString(Type).split(DataType.TAB_SPACE_SPLIT)\r
 \r
 ## ModuleBuildClassObject\r
@@ -189,7 +189,7 @@ class ModuleBuildClassObject(object):
 \r
         self.Binaries                = []\r
         self.Sources                 = []\r
-        self.LibraryClasses          = sdict()\r
+        self.LibraryClasses          = OrderedDict()\r
         self.Libraries               = []\r
         self.Protocols               = []\r
         self.Ppis                    = []\r
@@ -405,7 +405,7 @@ class ItemBuild(object):
 #\r
 # @var WorkspaceDir:      To store value for WorkspaceDir\r
 # @var SupArchList:       To store value for SupArchList, selection scope is in below list\r
-#                         EBC | IA32 | X64 | IPF | ARM | PPC\r
+#                         EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64\r
 # @var BuildTarget:       To store value for WorkspaceDir, selection scope is in below list\r
 #                         RELEASE | DEBUG\r
 # @var SkuId:             To store value for SkuId\r
@@ -748,7 +748,8 @@ class WorkspaceBuild(object):
                 #\r
                 Pb.Specification = ModuleHeader.Specification\r
                 Pb.Specification[TAB_INF_DEFINES_EDK_RELEASE_VERSION] = ModuleHeader.EdkReleaseVersion\r
-                Pb.Specification[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION] = ModuleHeader.EfiSpecificationVersion\r
+                Pb.Specification[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION] = ModuleHeader.UefiSpecificationVersion\r
+                Pb.Specification[TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION] = ModuleHeader.UefiSpecificationVersion\r
                 Pb.AutoGenVersion = int(ModuleHeader.InfVersion, 0)\r
 \r
                 #\r
@@ -863,7 +864,7 @@ class WorkspaceBuild(object):
                             for Libs in Pb.LibraryClass:\r
                                 for Type in Libs.SupModList:\r
                                     Instance = self.FindLibraryClassInstanceOfLibrary(Lib, Arch, Type)\r
-                                    if Instance == None:\r
+                                    if Instance is None:\r
                                         Instance = RecommendedInstance\r
                                     Pb.LibraryClasses[(Lib, Type)] = Instance\r
                         else:\r
@@ -871,7 +872,7 @@ class WorkspaceBuild(object):
                             # For Module\r
                             #\r
                             Instance = self.FindLibraryClassInstanceOfModule(Lib, Arch, Pb.ModuleType, Inf)\r
-                            if Instance == None:\r
+                            if Instance is None:\r
                                 Instance = RecommendedInstance\r
                             Pb.LibraryClasses[(Lib, Pb.ModuleType)] = Instance\r
 \r
@@ -911,7 +912,7 @@ class WorkspaceBuild(object):
                     if not self.IsModuleDefinedInPlatform(Inf, Arch, InfList):\r
                         continue\r
                     Module = self.Build[Arch].ModuleDatabase[Inf]\r
-                    if Module.LibraryClass == None or Module.LibraryClass == []:\r
+                    if Module.LibraryClass is None or Module.LibraryClass == []:\r
                         self.UpdateLibrariesOfModule(Platform, Module, Arch)\r
                         for Key in Module.LibraryClasses:\r
                             Lib = Module.LibraryClasses[Key]\r
@@ -928,13 +929,13 @@ class WorkspaceBuild(object):
         ModuleDatabase = self.Build[Arch].ModuleDatabase\r
         ModuleType = Module.ModuleType\r
 \r
-        # check R8 module\r
+        # check Edk module\r
         if Module.AutoGenVersion < 0x00010005:\r
             EdkLogger.verbose("")\r
             EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), Arch))\r
             LibraryConsumerList = [Module]\r
 \r
-            # "CompilerStub" is a must for R8 modules\r
+            # "CompilerStub" is a must for Edk modules\r
             Module.Libraries.append("CompilerStub")\r
             while len(LibraryConsumerList) > 0:\r
                 M = LibraryConsumerList.pop()\r
@@ -951,11 +952,11 @@ class WorkspaceBuild(object):
                         EdkLogger.verbose("\t" + LibraryName + " : " + LibraryFile)\r
             return\r
 \r
-        # R9 module\r
+        # EdkII module\r
         LibraryConsumerList = [Module]\r
         Constructor         = []\r
-        ConsumedByList      = sdict()\r
-        LibraryInstance     = sdict()\r
+        ConsumedByList      = OrderedDict()\r
+        LibraryInstance     = OrderedDict()\r
 \r
         EdkLogger.verbose("")\r
         EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), Arch))\r
@@ -968,15 +969,15 @@ class WorkspaceBuild(object):
                     continue\r
 \r
                 LibraryClassName = Key[0]\r
-                if LibraryClassName not in LibraryInstance or LibraryInstance[LibraryClassName] == None:\r
-                    if LibraryPath == None or LibraryPath == "":\r
+                if LibraryClassName not in LibraryInstance or LibraryInstance[LibraryClassName] is None:\r
+                    if LibraryPath is None or LibraryPath == "":\r
                         LibraryInstance[LibraryClassName] = None\r
                         continue\r
                     LibraryModule = ModuleDatabase[LibraryPath]\r
                     LibraryInstance[LibraryClassName] = LibraryModule\r
                     LibraryConsumerList.append(LibraryModule)\r
                     EdkLogger.verbose("\t" + LibraryClassName + " : " + str(LibraryModule))\r
-                elif LibraryPath == None or LibraryPath == "":\r
+                elif LibraryPath is None or LibraryPath == "":\r
                     continue\r
                 else:\r
                     LibraryModule = LibraryInstance[LibraryClassName]\r
@@ -1001,7 +1002,7 @@ class WorkspaceBuild(object):
         Q = []\r
         for LibraryClassName in LibraryInstance:\r
             M = LibraryInstance[LibraryClassName]\r
-            if M == None:\r
+            if M is None:\r
                 EdkLogger.error("AutoGen", AUTOGEN_ERROR,\r
                                 "Library instance for library class [%s] is not found" % LibraryClassName,\r
                                 ExtraData="\t%s [%s]" % (str(Module), Arch))\r
@@ -1010,7 +1011,7 @@ class WorkspaceBuild(object):
             # check if there're duplicate library classes\r
             #\r
             for Lc in M.LibraryClass:\r
-                if Lc.SupModList != None and ModuleType not in Lc.SupModList:\r
+                if Lc.SupModList is not None and ModuleType not in Lc.SupModList:\r
                     EdkLogger.error("AutoGen", AUTOGEN_ERROR,\r
                                     "Module type [%s] is not supported by library instance [%s]" % (ModuleType, str(M)),\r
                                     ExtraData="\t%s" % str(Module))\r
@@ -1096,7 +1097,7 @@ class WorkspaceBuild(object):
         # The DAG Topo sort produces the destructor order, so the list of constructors must generated in the reverse order\r
         #\r
         SortedLibraryList.reverse()\r
-        Module.LibraryClasses = sdict()\r
+        Module.LibraryClasses = OrderedDict()\r
         for L in SortedLibraryList:\r
             for Lc in L.LibraryClass:\r
                 Module.LibraryClasses[Lc.LibraryClass, ModuleType] = str(L)\r
@@ -1379,7 +1380,7 @@ class WorkspaceBuild(object):
             if (Name, Guid) in Pcds:\r
                 OwnerPlatform = Dsc\r
                 Pcd = Pcds[(Name, Guid)]\r
-                if Pcd.Type != '' and Pcd.Type != None:\r
+                if Pcd.Type != '' and Pcd.Type is not None:\r
                     NewType = Pcd.Type\r
                     if NewType in DataType.PCD_DYNAMIC_TYPE_LIST:\r
                         NewType = DataType.TAB_PCDS_DYNAMIC\r
@@ -1395,13 +1396,13 @@ class WorkspaceBuild(object):
                     EdkLogger.error("AutoGen", PARSER_ERROR, ErrorMsg)\r
 \r
 \r
-                if Pcd.DatumType != '' and Pcd.DatumType != None:\r
+                if Pcd.DatumType != '' and Pcd.DatumType is not None:\r
                     DatumType = Pcd.DatumType\r
-                if Pcd.TokenValue != '' and Pcd.TokenValue != None:\r
+                if Pcd.TokenValue != '' and Pcd.TokenValue is not None:\r
                     Token = Pcd.TokenValue\r
-                if Pcd.DefaultValue != '' and Pcd.DefaultValue != None:\r
+                if Pcd.DefaultValue != '' and Pcd.DefaultValue is not None:\r
                     Value = Pcd.DefaultValue\r
-                if Pcd.MaxDatumSize != '' and Pcd.MaxDatumSize != None:\r
+                if Pcd.MaxDatumSize != '' and Pcd.MaxDatumSize is not None:\r
                     MaxDatumSize = Pcd.MaxDatumSize\r
                 SkuInfoList =  Pcd.SkuInfoList\r
                 \r