]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools: use set instead of list for a variable to be used with in
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / AutoGen.py
index dbc9f893c2f1f310cb04e7dcf0a2b0ed9c903723..a4e36d1a2fb4f3a47157f932157d7a7e8a86f222 100644 (file)
@@ -256,12 +256,6 @@ class WorkspaceAutoGen(AutoGen):
     def _InitWorker(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb,\r
               BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=None, Fvs=None, Caps=None, SkuId='', UniFlag=None,\r
               Progress=None, BuildModule=None):\r
-        if Fds is None:\r
-            Fds = []\r
-        if Fvs is None:\r
-            Fvs = []\r
-        if Caps is None:\r
-            Caps = []\r
         self.BuildDatabase  = MetaFileDb\r
         self.MetaFile       = ActivePlatform\r
         self.WorkspaceDir   = WorkspaceDir\r
@@ -276,9 +270,9 @@ class WorkspaceAutoGen(AutoGen):
         self.TargetTxt      = BuildConfig\r
         self.ToolDef        = ToolDefinition\r
         self.FdfFile        = FlashDefinitionFile\r
-        self.FdTargetList   = Fds\r
-        self.FvTargetList   = Fvs\r
-        self.CapTargetList  = Caps\r
+        self.FdTargetList   = Fds if Fds else []\r
+        self.FvTargetList   = Fvs if Fvs else []\r
+        self.CapTargetList  = Caps if Caps else []\r
         self.AutoGenObjectList = []\r
         self._BuildDir      = None\r
         self._FvDir         = None\r
@@ -361,13 +355,12 @@ class WorkspaceAutoGen(AutoGen):
             # but the path (self.MetaFile.Path) is the real path\r
             for key in self.FdfProfile.InfDict:\r
                 if key == 'ArchTBD':\r
-                    Platform_cache = {}\r
                     MetaFile_cache = {}\r
                     for Arch in self.ArchList:\r
-                        Platform_cache[Arch] = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]\r
+                        Current_Platform_cache = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]\r
                         MetaFile_cache[Arch] = set()\r
-                        for Pkey in Platform_cache[Arch].Modules:\r
-                            MetaFile_cache[Arch].add(Platform_cache[Arch].Modules[Pkey].MetaFile)\r
+                        for Pkey in Current_Platform_cache.Modules:\r
+                            MetaFile_cache[Arch].add(Current_Platform_cache.Modules[Pkey].MetaFile)\r
                     for Inf in self.FdfProfile.InfDict[key]:\r
                         ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace, Arch)\r
                         for Arch in self.ArchList:\r
@@ -1457,13 +1450,10 @@ class PlatformAutoGen(AutoGen):
                         self._NonDynaPcdList_.remove (self._NonDynaPcdList_[Index])\r
                         PcdFromModule.Pending = False\r
                         self._NonDynaPcdList_.append (PcdFromModule)\r
-        # Parse the DynamicEx PCD from the AsBuild INF module list of FDF.\r
-        DscModuleList = []\r
-        for ModuleInf in self.Platform.Modules.keys():\r
-            DscModuleList.append (os.path.normpath(ModuleInf.Path))\r
+        DscModuleSet = {os.path.normpath(ModuleInf.Path) for ModuleInf in self.Platform.Modules}\r
         # add the PCD from modules that listed in FDF but not in DSC to Database \r
         for InfName in FdfModuleList:\r
-            if InfName not in DscModuleList:\r
+            if InfName not in DscModuleSet:\r
                 InfClass = PathClass(InfName)\r
                 M = self.BuildDatabase[InfClass, self.Arch, self.BuildTarget, self.ToolChain]\r
                 # If a module INF in FDF but not in current arch's DSC module list, it must be module (either binary or source) \r