public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>, Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [PATCH v1 6/9] BaseTools: refactor DepexSection.GenSection
Date: Fri, 13 Apr 2018 13:51:33 -0700	[thread overview]
Message-ID: <4461066fd603e3dc8eb1c16538da6a93d40606bf.1523652584.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1523652583.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1523652583.git.jaben.carsey@intel.com>

From: Jaben <jaben.carsey@intel.com>

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>
---
 BaseTools/Source/Python/GenFds/DepexSection.py | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/Python/GenFds/DepexSection.py
index ef30a2f083c6..4ed1aa779292 100644
--- a/BaseTools/Source/Python/GenFds/DepexSection.py
+++ b/BaseTools/Source/Python/GenFds/DepexSection.py
@@ -1,7 +1,7 @@
 ## @file
 # process depex section generation
 #
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -76,12 +76,10 @@ class DepexSection (DepexSectionClassObject):
     #   @param  Dict        dictionary contains macro and its value
     #   @retval tuple       (Generated file name list, section alignment)
     #
-    def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}, IsMakefile = False):
-        
+    def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = None, IsMakefile = False):
         if self.ExpressionProcessed == False:
             self.Expression = self.Expression.replace("\n", " ").replace("\r", " ")
             ExpList = self.Expression.split()
-            ExpGuidDict = {}
 
             for Exp in ExpList:
                 if Exp.upper() not in ('AND', 'OR', 'NOT', 'TRUE', 'FALSE', 'SOR', 'BEFORE', 'AFTER', 'END'):
@@ -90,10 +88,7 @@ class DepexSection (DepexSectionClassObject):
                         EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE,
                                         "Depex GUID %s could not be found in build DB! (ModuleName: %s)" % (Exp, ModuleName))
 
-                    ExpGuidDict[Exp] = GuidStr
-
-            for Item in ExpGuidDict:
-                self.Expression = self.Expression.replace(Item, ExpGuidDict[Item])
+                    self.Expression = self.Expression.replace(Exp, GuidStr)
 
             self.Expression = self.Expression.strip()
             self.ExpressionProcessed = True
@@ -120,5 +115,4 @@ class DepexSection (DepexSectionClassObject):
         OutputFile = os.path.normpath(OutputFile)
 
         GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)
-        FileList = [OutputFile]
-        return FileList, self.Alignment
+        return [OutputFile], self.Alignment
-- 
2.16.2.windows.1



  parent reply	other threads:[~2018-04-13 20:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-13 20:51 [PATCH v1 0/9] BaseTools: refactoring Jaben Carsey
2018-04-13 20:51 ` [PATCH v1 1/9] BaseTools: remove unused local variable Jaben Carsey
2018-04-13 20:51 ` [PATCH v1 2/9] BaseTools: change DscBuildData functions without need for self to staticmethod Jaben Carsey
2018-04-13 20:51 ` [PATCH v1 3/9] BaseTools: Remove unused functions from DscBuildData Jaben Carsey
2018-04-13 20:51 ` [PATCH v1 4/9] BaseTools: move RegEx compile out of loops Jaben Carsey
2018-04-13 20:51 ` [PATCH v1 5/9] BaseTools: use dictionary.get() when we have value if not found Jaben Carsey
2018-04-13 20:51 ` Jaben Carsey [this message]
2018-04-13 20:51 ` [PATCH v1 7/9] BaseTools: FdfParser refactor to remove a dictionary Jaben Carsey
2018-04-13 20:51 ` [PATCH v1 8/9] BaseTools: FdfParser - refactor functions to make static Jaben Carsey
2018-04-13 20:51 ` [PATCH v1 9/9] BaseTools: FfsInfStatement - remove unused function Jaben Carsey
2018-04-17 13:18 ` [PATCH v1 0/9] BaseTools: refactoring Zhu, Yonghong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4461066fd603e3dc8eb1c16538da6a93d40606bf.1523652584.git.jaben.carsey@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox