]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Workspace/MetaFileParser.py
BaseTools: Support DSC component !include PCD items
[mirror_edk2.git] / BaseTools / Source / Python / Workspace / MetaFileParser.py
index ae8cf57e389726561dd833e1893eacae1860d4f6..322ed384496658635e8b87c1de4e75d6d564713c 100644 (file)
@@ -1504,12 +1504,12 @@ class DscParser(MetaFileParser):
             # Allow using system environment variables  in path after !include\r
             #\r
             __IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']\r
-            if "ECP_SOURCE" in GlobalData.gGlobalDefines.keys():\r
+            if "ECP_SOURCE" in GlobalData.gGlobalDefines:\r
                 __IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE']\r
             #\r
             # During GenFds phase call DSC parser, will go into this branch.\r
             #\r
-            elif "ECP_SOURCE" in GlobalData.gCommandLineDefines.keys():\r
+            elif "ECP_SOURCE" in GlobalData.gCommandLineDefines:\r
                 __IncludeMacros['ECP_SOURCE'] = GlobalData.gCommandLineDefines['ECP_SOURCE']\r
 \r
             __IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE']\r
@@ -1538,9 +1538,13 @@ class DscParser(MetaFileParser):
             self._FileWithError = IncludedFile1\r
 \r
             IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile1, MODEL_FILE_DSC, False)\r
-            Owner = self._Content[self._ContentIndex - 1][0]\r
+            FromItem = self._Content[self._ContentIndex - 1][0]\r
+            if self._Content[self._ContentIndex - 1][8] != -1.0:\r
+                Owner = self._Content[self._ContentIndex - 1][8]\r
+            else:\r
+                Owner = self._Content[self._ContentIndex - 1][0]\r
             Parser = DscParser(IncludedFile1, self._FileType, self._Arch, IncludedFileTable,\r
-                               Owner=Owner, From=Owner)\r
+                               Owner=Owner, From=FromItem)\r
 \r
             self.IncludedFiles.add (IncludedFile1)\r
 \r
@@ -1552,7 +1556,10 @@ class DscParser(MetaFileParser):
 \r
             # set the parser status with current status\r
             Parser._SectionName = self._SectionName\r
-            Parser._SectionType = self._SectionType\r
+            if self._InSubsection:\r
+                Parser._SectionType = self._SubsectionType\r
+            else:\r
+                Parser._SectionType = self._SectionType\r
             Parser._Scope = self._Scope\r
             Parser._Enabled = self._Enabled\r
             # Parse the included file\r