diff options
author | Valentin David <valentin.david@codethink.co.uk> | 2018-06-11 15:57:28 +0200 |
---|---|---|
committer | Valentin David <valentin.david@codethink.co.uk> | 2018-08-02 16:17:01 +0200 |
commit | 483b0223bccad8c4c843d445f6621eefe2000744 (patch) | |
tree | 268b53c18bb7446b7ee05b21672639ca4d63603a /buildstream/_frontend | |
parent | 3bae4aebf7e95c04ea688469b77f8954848c02d5 (diff) | |
download | buildstream-483b0223bccad8c4c843d445f6621eefe2000744.tar.gz |
Make Project owner of Loader.
Diffstat (limited to 'buildstream/_frontend')
-rw-r--r-- | buildstream/_frontend/app.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/buildstream/_frontend/app.py b/buildstream/_frontend/app.py index 04a90ea32..4039716c8 100644 --- a/buildstream/_frontend/app.py +++ b/buildstream/_frontend/app.py @@ -33,6 +33,7 @@ from .. import Scope # Import various buildstream internals from .._context import Context +from .._platform import Platform from .._project import Project from .._exceptions import BstError, StreamError, LoadError, LoadErrorReason, AppError from .._message import Message, MessageType, unconditional_messages @@ -66,6 +67,7 @@ class App(): self.context = None # The Context object self.stream = None # The Stream object self.project = None # The toplevel Project object + self.loader = None self.logger = None # The LogLine object self.interactive = None # Whether we are running in interactive mode self.colors = None # Whether to use colors in logging @@ -198,12 +200,27 @@ class App(): if option_value is not None: setattr(self.context, context_attr, option_value) + Platform.create_instance(self.context) + + # Create the logger right before setting the message handler + self.logger = LogLine(self.context, + self._content_profile, + self._format_profile, + self._success_profile, + self._error_profile, + self._detail_profile, + indent=INDENT) + + # Propagate pipeline feedback to the user + self.context.set_message_handler(self._message_handler) + # # Load the Project # try: self.project = Project(directory, self.context, cli_options=self._main_options['option'], default_mirror=self._main_options.get('default_mirror')) + self.loader = self.project.loader except LoadError as e: # Let's automatically start a `bst init` session in this case @@ -218,24 +235,13 @@ class App(): except BstError as e: self._error_exit(e, "Error loading project") - # Create the logger right before setting the message handler - self.logger = LogLine(self.context, - self._content_profile, - self._format_profile, - self._success_profile, - self._error_profile, - self._detail_profile, - indent=INDENT) - - # Propagate pipeline feedback to the user - self.context.set_message_handler(self._message_handler) - # Now that we have a logger and message handler, # we can override the global exception hook. sys.excepthook = self._global_exception_handler # Create the stream right away, we'll need to pass it around self.stream = Stream(self.context, self.project, self._session_start, + self.loader, session_start_callback=self.session_start_cb, interrupt_callback=self._interrupt_handler, ticker_callback=self._tick, |