]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/DepexSection.py
BaseTools: Remove equality operator with None
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / DepexSection.py
index 39678b23e96df52752caeedb2aa0e5cddcc036aa..ef30a2f083c6624025f5e2789ec2f953501b53c8 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process depex section generation\r
 #\r
-#  Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -19,12 +19,12 @@ import Section
 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 import subprocess\r
 from Ffs import Ffs\r
-import os\r
+import Common.LongFilePathOs as os\r
 from CommonDataClass.FdfClass import DepexSectionClassObject\r
 from AutoGen.GenDepex import DependencyExpression\r
-import shutil\r
 from Common import EdkLogger\r
 from Common.BuildToolError import *\r
+from Common.Misc import PathClass\r
 \r
 ## generate data section\r
 #\r
@@ -39,7 +39,22 @@ class DepexSection (DepexSectionClassObject):
 \r
     def __FindGuidValue(self, CName):\r
         for Arch in GenFdsGlobalVariable.ArchList:\r
-            for PkgDb in GenFdsGlobalVariable.WorkSpace.PackageList:\r
+            PkgList = GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform,\r
+                                                                    Arch,\r
+                                                                    GenFdsGlobalVariable.TargetName,\r
+                                                                    GenFdsGlobalVariable.ToolChainTag)\r
+            for Inf in GenFdsGlobalVariable.FdfParser.Profile.InfList:\r
+                ModuleFile = PathClass(Inf, GenFdsGlobalVariable.WorkSpaceDir)\r
+                ModuleData = GenFdsGlobalVariable.WorkSpace.BuildObject[\r
+                                                            ModuleFile,\r
+                                                            Arch,\r
+                                                            GenFdsGlobalVariable.TargetName,\r
+                                                            GenFdsGlobalVariable.ToolChainTag\r
+                                                            ]\r
+                for Pkg in ModuleData.Packages:\r
+                    if Pkg not in PkgList:\r
+                        PkgList.append(Pkg)\r
+            for PkgDb in PkgList:\r
                 if CName in PkgDb.Ppis:\r
                     return PkgDb.Ppis[CName]\r
                 if CName in PkgDb.Protocols:\r
@@ -61,7 +76,7 @@ class DepexSection (DepexSectionClassObject):
     #   @param  Dict        dictionary contains macro and its value\r
     #   @retval tuple       (Generated file name list, section alignment)\r
     #\r
-    def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}):\r
+    def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}, IsMakefile = False):\r
         \r
         if self.ExpressionProcessed == False:\r
             self.Expression = self.Expression.replace("\n", " ").replace("\r", " ")\r
@@ -71,7 +86,7 @@ class DepexSection (DepexSectionClassObject):
             for Exp in ExpList:\r
                 if Exp.upper() not in ('AND', 'OR', 'NOT', 'TRUE', 'FALSE', 'SOR', 'BEFORE', 'AFTER', 'END'):\r
                     GuidStr = self.__FindGuidValue(Exp)\r
-                    if GuidStr == None:\r
+                    if GuidStr is None:\r
                         EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE,\r
                                         "Depex GUID %s could not be found in build DB! (ModuleName: %s)" % (Exp, ModuleName))\r
 \r
@@ -104,6 +119,6 @@ class DepexSection (DepexSectionClassObject):
         OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')\r
         OutputFile = os.path.normpath(OutputFile)\r
 \r
-        GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType))\r
+        GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)\r
         FileList = [OutputFile]\r
         return FileList, self.Alignment\r