From ce1b5bf600461465d10a61835a2783dddc1ac59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Tue, 16 Jan 2018 09:19:45 +0100 Subject: Add list of projects to Context --- buildstream/_context.py | 21 +++++++++++++++++++++ buildstream/_project.py | 2 ++ 2 files changed, 23 insertions(+) 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 992dd6274..7a5c1f9de 100644 --- a/buildstream/_project.py +++ b/buildstream/_project.py @@ -82,6 +82,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 -- cgit v1.2.1