[edk2] [Patch] BaseTools: Structure pcd value assignment

BobCF posted 1 patch 5 years, 9 months ago
Failed in applying to current master (apply log)
.../Source/Python/Workspace/MetaFileParser.py      | 23 +++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
[edk2] [Patch] BaseTools: Structure pcd value assignment
Posted by BobCF 5 years, 9 months ago
Enable Structure pcd value assigned by FixedPcd

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 .../Source/Python/Workspace/MetaFileParser.py      | 23 +++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 88c7bb374c..ac08f39c30 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -1609,17 +1609,26 @@ class DscParser(MetaFileParser):
         ValList, Valid, Index = AnalyzeDscPcd(self._ValueList[2], self._ItemType)
         if not Valid:
             EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect.", File=self._FileWithError, Line=self._LineIndex + 1,
                             ExtraData="%s.%s|%s" % (self._ValueList[0], self._ValueList[1], self._ValueList[2]))
         PcdValue = ValList[Index]
-        if PcdValue and "." not in self._ValueList[0]:
-            try:
-                ValList[Index] = ValueExpression(PcdValue, self._Macros)(True)
-            except WrnExpression, Value:
-                ValList[Index] = Value.result
-            except:
-                pass
+        if PcdValue:
+            if "." not in self._ValueList[0]:
+                try:
+                    ValList[Index] = ValueExpression(PcdValue, self._Macros)(True)
+                except WrnExpression, Value:
+                    ValList[Index] = Value.result
+                except:
+                    pass
+            else:
+                if PcdValue in self._Macros:
+                    try:
+                        ValList[Index] = ValueExpression(PcdValue, self._Macros)(True)
+                    except WrnExpression, Value:
+                        ValList[Index] = Value.result
+                    except:
+                        pass
 
         if ValList[Index] == 'True':
             ValList[Index] = '1'
         if ValList[Index] == 'False':
             ValList[Index] = '0'
-- 
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel