]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: refactor DepexSection.GenSection
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Fri, 13 Apr 2018 20:51:33 +0000 (04:51 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 17 Apr 2018 12:49:53 +0000 (20:49 +0800)
change default parameter value to None since the parameter isn't used.
remove temporary dictionary and just do the reaplce call.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/GenFds/DepexSection.py

index ef30a2f083c6624025f5e2789ec2f953501b53c8..4ed1aa77929207e294ca7d7d809f38df7c3da5ce 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process depex section generation\r
 #\r
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2018, 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
@@ -76,12 +76,10 @@ 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 = {}, IsMakefile = False):\r
-        \r
+    def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = None, IsMakefile = False):\r
         if self.ExpressionProcessed == False:\r
             self.Expression = self.Expression.replace("\n", " ").replace("\r", " ")\r
             ExpList = self.Expression.split()\r
-            ExpGuidDict = {}\r
 \r
             for Exp in ExpList:\r
                 if Exp.upper() not in ('AND', 'OR', 'NOT', 'TRUE', 'FALSE', 'SOR', 'BEFORE', 'AFTER', 'END'):\r
@@ -90,10 +88,7 @@ class DepexSection (DepexSectionClassObject):
                         EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE,\r
                                         "Depex GUID %s could not be found in build DB! (ModuleName: %s)" % (Exp, ModuleName))\r
 \r
-                    ExpGuidDict[Exp] = GuidStr\r
-\r
-            for Item in ExpGuidDict:\r
-                self.Expression = self.Expression.replace(Item, ExpGuidDict[Item])\r
+                    self.Expression = self.Expression.replace(Exp, GuidStr)\r
 \r
             self.Expression = self.Expression.strip()\r
             self.ExpressionProcessed = True\r
@@ -120,5 +115,4 @@ class DepexSection (DepexSectionClassObject):
         OutputFile = os.path.normpath(OutputFile)\r
 \r
         GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)\r
-        FileList = [OutputFile]\r
-        return FileList, self.Alignment\r
+        return [OutputFile], self.Alignment\r