]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/Workspace/InfBuildData: move functions
authorCarsey, Jaben <jaben.carsey@intel.com>
Thu, 10 Jan 2019 18:39:46 +0000 (02:39 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Mon, 21 Jan 2019 10:03:32 +0000 (18:03 +0800)
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>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/Python/Common/Misc.py
BaseTools/Source/Python/Workspace/InfBuildData.py

index 32de5d9100c8035b8a1f4cae91319babb9462f0f..ae66afd26f8ace51d86953fb2b7ee5715547305b 100644 (file)
@@ -611,44 +611,6 @@ def GuidValue(CName, PackageList, Inffile = None):
             return P.Guids[CName]\r
     return None\r
 \r
-## Get Protocol value from given packages\r
-#\r
-#   @param      CName           The CName of the GUID\r
-#   @param      PackageList     List of packages looking-up in\r
-#   @param      Inffile         The driver file\r
-#\r
-#   @retval     GuidValue   if the CName is found in any given package\r
-#   @retval     None        if the CName is not found in all given packages\r
-#\r
-def ProtocolValue(CName, PackageList, Inffile = None):\r
-    for P in PackageList:\r
-        ProtocolKeys = P.Protocols.keys()\r
-        if Inffile and P._PrivateProtocols:\r
-            if not Inffile.startswith(P.MetaFile.Dir):\r
-                ProtocolKeys = [x for x in P.Protocols if x not in P._PrivateProtocols]\r
-        if CName in ProtocolKeys:\r
-            return P.Protocols[CName]\r
-    return None\r
-\r
-## Get PPI value from given packages\r
-#\r
-#   @param      CName           The CName of the GUID\r
-#   @param      PackageList     List of packages looking-up in\r
-#   @param      Inffile         The driver file\r
-#\r
-#   @retval     GuidValue   if the CName is found in any given package\r
-#   @retval     None        if the CName is not found in all given packages\r
-#\r
-def PpiValue(CName, PackageList, Inffile = None):\r
-    for P in PackageList:\r
-        PpiKeys = P.Ppis.keys()\r
-        if Inffile and P._PrivatePpis:\r
-            if not Inffile.startswith(P.MetaFile.Dir):\r
-                PpiKeys = [x for x in P.Ppis if x not in P._PrivatePpis]\r
-        if CName in PpiKeys:\r
-            return P.Ppis[CName]\r
-    return None\r
-\r
 ## A string template class\r
 #\r
 #  This class implements a template for string replacement. A string template\r
index 709854de1ed52af3aae47ebcb2e8c4db6781afc5..f0c7e6ddd4f1b236d2a8e79a53651544e20c634d 100644 (file)
@@ -21,6 +21,44 @@ from .MetaFileParser import *
 from collections import OrderedDict\r
 from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClassObject, PcdClassObject\r
 \r
+## Get Protocol value from given packages\r
+#\r
+#   @param      CName           The CName of the GUID\r
+#   @param      PackageList     List of packages looking-up in\r
+#   @param      Inffile         The driver file\r
+#\r
+#   @retval     GuidValue   if the CName is found in any given package\r
+#   @retval     None        if the CName is not found in all given packages\r
+#\r
+def _ProtocolValue(CName, PackageList, Inffile = None):\r
+    for P in PackageList:\r
+        ProtocolKeys = P.Protocols.keys()\r
+        if Inffile and P._PrivateProtocols:\r
+            if not Inffile.startswith(P.MetaFile.Dir):\r
+                ProtocolKeys = [x for x in P.Protocols if x not in P._PrivateProtocols]\r
+        if CName in ProtocolKeys:\r
+            return P.Protocols[CName]\r
+    return None\r
+\r
+## Get PPI value from given packages\r
+#\r
+#   @param      CName           The CName of the GUID\r
+#   @param      PackageList     List of packages looking-up in\r
+#   @param      Inffile         The driver file\r
+#\r
+#   @retval     GuidValue   if the CName is found in any given package\r
+#   @retval     None        if the CName is not found in all given packages\r
+#\r
+def _PpiValue(CName, PackageList, Inffile = None):\r
+    for P in PackageList:\r
+        PpiKeys = P.Ppis.keys()\r
+        if Inffile and P._PrivatePpis:\r
+            if not Inffile.startswith(P.MetaFile.Dir):\r
+                PpiKeys = [x for x in P.Ppis if x not in P._PrivatePpis]\r
+        if CName in PpiKeys:\r
+            return P.Ppis[CName]\r
+    return None\r
+\r
 ## Module build information from INF file\r
 #\r
 #  This class is used to retrieve information stored in database and convert them\r
@@ -566,7 +604,7 @@ class InfBuildData(ModuleBuildClassObject):
         RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch, self._Platform]\r
         for Record in RecordList:\r
             CName = Record[0]\r
-            Value = ProtocolValue(CName, self.Packages, self.MetaFile.Path)\r
+            Value = _ProtocolValue(CName, self.Packages, self.MetaFile.Path)\r
             if Value is None:\r
                 PackageList = "\n\t".join(str(P) for P in self.Packages)\r
                 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,\r
@@ -590,7 +628,7 @@ class InfBuildData(ModuleBuildClassObject):
         RecordList = self._RawData[MODEL_EFI_PPI, self._Arch, self._Platform]\r
         for Record in RecordList:\r
             CName = Record[0]\r
-            Value = PpiValue(CName, self.Packages, self.MetaFile.Path)\r
+            Value = _PpiValue(CName, self.Packages, self.MetaFile.Path)\r
             if Value is None:\r
                 PackageList = "\n\t".join(str(P) for P in self.Packages)\r
                 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,\r
@@ -762,9 +800,9 @@ class InfBuildData(ModuleBuildClassObject):
                         Value = Token\r
                     else:\r
                         # get the GUID value now\r
-                        Value = ProtocolValue(Token, self.Packages, self.MetaFile.Path)\r
+                        Value = _ProtocolValue(Token, self.Packages, self.MetaFile.Path)\r
                         if Value is None:\r
-                            Value = PpiValue(Token, self.Packages, self.MetaFile.Path)\r
+                            Value = _PpiValue(Token, self.Packages, self.MetaFile.Path)\r
                             if Value is None:\r
                                 Value = GuidValue(Token, self.Packages, self.MetaFile.Path)\r
 \r