This is an automated email from the ASF dual-hosted git repository.

juergbi pushed a commit to branch juerg/nested-junctions
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 4952103e23186b2be697cc2dd678e7c7efda0d99
Author: Jürg Billeter <[email protected]>
AuthorDate: Fri Nov 15 18:11:07 2024 +0100

    _includes.py: Improve message for bug in subproject include processing
---
 src/buildstream/_includes.py | 5 +++++
 src/buildstream/_project.py  | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/buildstream/_includes.py b/src/buildstream/_includes.py
index 5aa821aac..5eefd0b59 100644
--- a/src/buildstream/_includes.py
+++ b/src/buildstream/_includes.py
@@ -172,6 +172,11 @@ class Includes:
             # guaranteed at this stage to be fully loaded.
             #
             if current_loader != loader:
+                assert (
+                    current_loader.project.base_variables is not None
+                ), "{}: Attempted to include file from a subproject that isn't 
fully loaded".format(
+                    include.get_provenance()
+                )
                 variables_node = current_loader.project.base_variables.clone()
                 variables = Variables(variables_node)
                 variables.expand(self._loaded[key])
diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py
index 10e410cdf..f89444197 100644
--- a/src/buildstream/_project.py
+++ b/src/buildstream/_project.py
@@ -56,7 +56,7 @@ _PROJECT_CONF_FILE = "project.conf"
 class ProjectConfig:
     def __init__(self):
         self.options = None  # OptionPool
-        self.base_variables = {}  # The base set of variables
+        self.base_variables = None  # The base set of variables
         self.element_overrides = {}  # Element specific configurations
         self.source_overrides = {}  # Source specific configurations
         self.mirrors = {}  # Dictionary of SourceMirror objects

Reply via email to