BaseTools: Fix a bug for --pcd used in ConditionalStatement calculate
authorYonghong Zhu <yonghong.zhu@intel.com>
Fri, 9 Mar 2018 07:18:35 +0000 (15:18 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 9 Mar 2018 08:37:35 +0000 (16:37 +0800)
Move the GlobalData.BuildOptionPcd before FdfParser() function and add
type check for Pcd item.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/GenFds/FdfParser.py
BaseTools/Source/Python/GenFds/GenFds.py
BaseTools/Source/Python/Workspace/MetaFileParser.py

index 76d7e6ac1903493c5c73edde44b6b15a3c6f0fd3..dda7ed4ce79867d9131aa13930f4ec5fe7b10a9e 100644 (file)
@@ -927,6 +927,8 @@ class FdfParser:
         MacroDict.update(GlobalData.gCommandLineDefines)\r
         if GlobalData.BuildOptionPcd:\r
             for Item in GlobalData.BuildOptionPcd:\r
+                if type(Item) is tuple:\r
+                    continue\r
                 PcdName, TmpValue = Item.split("=")\r
                 TmpValue = BuildOptionValue(TmpValue, {})\r
                 MacroDict[PcdName.strip()] = TmpValue\r
index 4c56cbb02a8e9a089080aa8fce70b43170ea1802..03126e35f47ae3259a094a0274059510baf41b86 100644 (file)
@@ -142,6 +142,7 @@ def main():
         else:\r
             EdkLogger.error("GenFds", OPTION_MISSING, "Missing active platform")\r
 \r
+        GlobalData.BuildOptionPcd     = Options.OptionPcd if Options.OptionPcd else {}\r
         GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform))\r
 \r
         if (Options.ConfDirectory):\r
@@ -326,7 +327,6 @@ def main():
                                     FvObj.FvRegionInFD = RegionObj.Size\r
                                     RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, FvObj)\r
 \r
-        GlobalData.BuildOptionPcd     = Options.OptionPcd if Options.OptionPcd else {}\r
         """Call GenFds"""\r
         GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList)\r
 \r
index 69bdf2161bec808410231458538cd6cdeba18cfa..2eb4c75e46587f8b7e238060abbfbd4b852ce971 100644 (file)
@@ -1245,6 +1245,8 @@ class DscParser(MetaFileParser):
             Macros.update(self._Symbols)\r
         if GlobalData.BuildOptionPcd:\r
             for Item in GlobalData.BuildOptionPcd:\r
+                if type(Item) is tuple:\r
+                    continue\r
                 PcdName, TmpValue = Item.split("=")\r
                 TmpValue = BuildOptionValue(TmpValue, self._GuidDict)\r
                 Macros[PcdName.strip()] = TmpValue\r