summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-01-16 09:19:45 +0100
committerJürg Billeter <j@bitron.ch>2018-01-16 15:56:07 +0100
commit1f3cb9f4772335f4b1402f1b96b17bf4030d7ce8 (patch)
tree7887b67e3edefc2383fc915044bd027c6a61225b
parentec5d6cda4f016a54c8b4ee91c2405758f4b47201 (diff)
downloadbuildstream-1f3cb9f4772335f4b1402f1b96b17bf4030d7ce8.tar.gz
Add list of projects to Context
-rw-r--r--buildstream/_context.py21
-rw-r--r--buildstream/_project.py2
2 files changed, 23 insertions, 0 deletions
diff --git a/buildstream/_context.py b/buildstream/_context.py
index 9c91eebb2..9801f54c4 100644
--- a/buildstream/_context.py
+++ b/buildstream/_context.py
@@ -109,6 +109,7 @@ class Context():
self._message_handler = None
self._message_depth = deque()
self._platform = None
+ self._projects = []
self._project_overrides = {}
self._fetch_subprojects = fetch_subprojects
@@ -207,6 +208,26 @@ class Context():
"{}: on-error should be one of: {}".format(
provenance, ", ".join(valid_actions)))
+ # _add_project():
+ #
+ # Add a project to the context.
+ #
+ # Args:
+ # project (Project): The project to add
+ #
+ def _add_project(self, project):
+ self._projects.append(project)
+
+ # _get_projects():
+ #
+ # Return the list of projects in the context.
+ #
+ # Returns:
+ # (list): The list of projects
+ #
+ def _get_projects(self):
+ return self._projects
+
# _get_overrides():
#
# Fetch the override dictionary for the active project. This returns
diff --git a/buildstream/_project.py b/buildstream/_project.py
index 25178e12c..6f23979a6 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -81,6 +81,8 @@ class Project():
self._load()
profile_end(Topics.LOAD_PROJECT, self.directory.replace(os.sep, '-'))
+ self._context._add_project(self)
+
# translate_url():
#
# Translates the given url which may be specified with an alias