public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Feng, Bob C" <bob.c.feng@intel.com>
To: "Carsey, Jaben" <jaben.carsey@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [Patch v1 2/5] BaseTools/Workspace/InfBuildData: move functions
Date: Thu, 17 Jan 2019 07:46:55 +0000	[thread overview]
Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D16005CF90@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <835f1263c2dcbe6ed697aed2565483a6e220d0fe.1547145461.git.jaben.carsey@intel.com>

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Carsey, Jaben 
Sent: Friday, January 11, 2019 2:40 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [Patch v1 2/5] BaseTools/Workspace/InfBuildData: move functions

Move ProtocolValue and PpiValue from Common.Misc to this file.
There were no other consumers of these 2 functions.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
 BaseTools/Source/Python/Common/Misc.py            | 38 ----------------
 BaseTools/Source/Python/Workspace/InfBuildData.py | 46 ++++++++++++++++++--
 2 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 43e016febcbb..25d8f9807fa3 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -611,44 +611,6 @@ def GuidValue(CName, PackageList, Inffile = None):
             return P.Guids[CName]
     return None
 
-## Get Protocol value from given packages -#
-#   @param      CName           The CName of the GUID
-#   @param      PackageList     List of packages looking-up in
-#   @param      Inffile         The driver file
-#
-#   @retval     GuidValue   if the CName is found in any given package
-#   @retval     None        if the CName is not found in all given packages
-#
-def ProtocolValue(CName, PackageList, Inffile = None):
-    for P in PackageList:
-        ProtocolKeys = P.Protocols.keys()
-        if Inffile and P._PrivateProtocols:
-            if not Inffile.startswith(P.MetaFile.Dir):
-                ProtocolKeys = [x for x in P.Protocols if x not in P._PrivateProtocols]
-        if CName in ProtocolKeys:
-            return P.Protocols[CName]
-    return None
-
-## Get PPI value from given packages
-#
-#   @param      CName           The CName of the GUID
-#   @param      PackageList     List of packages looking-up in
-#   @param      Inffile         The driver file
-#
-#   @retval     GuidValue   if the CName is found in any given package
-#   @retval     None        if the CName is not found in all given packages
-#
-def PpiValue(CName, PackageList, Inffile = None):
-    for P in PackageList:
-        PpiKeys = P.Ppis.keys()
-        if Inffile and P._PrivatePpis:
-            if not Inffile.startswith(P.MetaFile.Dir):
-                PpiKeys = [x for x in P.Ppis if x not in P._PrivatePpis]
-        if CName in PpiKeys:
-            return P.Ppis[CName]
-    return None
-
 ## A string template class
 #
 #  This class implements a template for string replacement. A string template diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 99bbecfd1f87..351f596d76b4 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -21,6 +21,44 @@ from .MetaFileParser import *  from collections import OrderedDict  from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClassObject, PcdClassObject
 
+## Get Protocol value from given packages #
+#   @param      CName           The CName of the GUID
+#   @param      PackageList     List of packages looking-up in
+#   @param      Inffile         The driver file
+#
+#   @retval     GuidValue   if the CName is found in any given package
+#   @retval     None        if the CName is not found in all given packages
+#
+def _ProtocolValue(CName, PackageList, Inffile = None):
+    for P in PackageList:
+        ProtocolKeys = P.Protocols.keys()
+        if Inffile and P._PrivateProtocols:
+            if not Inffile.startswith(P.MetaFile.Dir):
+                ProtocolKeys = [x for x in P.Protocols if x not in P._PrivateProtocols]
+        if CName in ProtocolKeys:
+            return P.Protocols[CName]
+    return None
+
+## Get PPI value from given packages
+#
+#   @param      CName           The CName of the GUID
+#   @param      PackageList     List of packages looking-up in
+#   @param      Inffile         The driver file
+#
+#   @retval     GuidValue   if the CName is found in any given package
+#   @retval     None        if the CName is not found in all given packages
+#
+def _PpiValue(CName, PackageList, Inffile = None):
+    for P in PackageList:
+        PpiKeys = P.Ppis.keys()
+        if Inffile and P._PrivatePpis:
+            if not Inffile.startswith(P.MetaFile.Dir):
+                PpiKeys = [x for x in P.Ppis if x not in P._PrivatePpis]
+        if CName in PpiKeys:
+            return P.Ppis[CName]
+    return None
+
 ## Module build information from INF file  #  #  This class is used to retrieve information stored in database and convert them @@ -645,7 +683,7 @@ class InfBuildData(ModuleBuildClassObject):
         RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch, self._Platform]
         for Record in RecordList:
             CName = Record[0]
-            Value = ProtocolValue(CName, self.Packages, self.MetaFile.Path)
+            Value = _ProtocolValue(CName, self.Packages, 
+ self.MetaFile.Path)
             if Value is None:
                 PackageList = "\n\t".join(str(P) for P in self.Packages)
                 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, @@ -669,7 +707,7 @@ class InfBuildData(ModuleBuildClassObject):
         RecordList = self._RawData[MODEL_EFI_PPI, self._Arch, self._Platform]
         for Record in RecordList:
             CName = Record[0]
-            Value = PpiValue(CName, self.Packages, self.MetaFile.Path)
+            Value = _PpiValue(CName, self.Packages, self.MetaFile.Path)
             if Value is None:
                 PackageList = "\n\t".join(str(P) for P in self.Packages)
                 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, @@ -875,9 +913,9 @@ class InfBuildData(ModuleBuildClassObject):
                         Value = Token
                     else:
                         # get the GUID value now
-                        Value = ProtocolValue(Token, self.Packages, self.MetaFile.Path)
+                        Value = _ProtocolValue(Token, self.Packages, 
+ self.MetaFile.Path)
                         if Value is None:
-                            Value = PpiValue(Token, self.Packages, self.MetaFile.Path)
+                            Value = _PpiValue(Token, self.Packages, 
+ self.MetaFile.Path)
                             if Value is None:
                                 Value = GuidValue(Token, self.Packages, self.MetaFile.Path)
 
--
2.16.2.windows.1



  reply	other threads:[~2019-01-17  7:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10 18:39 [Patch v1 0/5] cleanup shared functions Jaben Carsey
2019-01-10 18:39 ` [Patch v1 1/5] BaseTools/build/build: refactor and move functions Jaben Carsey
2019-01-17  7:46   ` Feng, Bob C
2019-01-10 18:39 ` [Patch v1 2/5] BaseTools/Workspace/InfBuildData: " Jaben Carsey
2019-01-17  7:46   ` Feng, Bob C [this message]
2019-01-10 18:39 ` [Patch v1 3/5] BaseTools/DscBuildData: move function Jaben Carsey
2019-01-17  7:47   ` Feng, Bob C
2019-01-10 18:39 ` [Patch v1 4/5] BaseTools/AutoGen: move functions Jaben Carsey
2019-01-17  7:47   ` Feng, Bob C
2019-01-10 18:39 ` [Patch v1 5/5] BaseTools/GenFds/Capsule: move function logic Jaben Carsey

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=08650203BA1BD64D8AD9B6D5D74A85D16005CF90@SHSMSX101.ccr.corp.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