in src/buildstream/_frontend/app.py [0:0]
def __init__(self, main_options):
#
# Public members
#
self.context = None # The Context object
self.stream = None # The Stream object
self.project = None # The toplevel Project object
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
#
# Private members
#
self._session_start = datetime.datetime.now()
self._session_name = None
self._main_options = main_options # Main CLI options, before any command
self._status = None # The Status object
self._fail_messages = {} # Failure messages by unique plugin id
self._interactive_failures = None # Whether to handle failures interactively
self._started = False # Whether a session has started
self._set_project_dir = False # Whether -C option was used
self._state = None # Frontend reads this and registers callbacks
# UI Colors Profiles
self._content_profile = Profile(fg="yellow")
self._format_profile = Profile(fg="cyan", dim=True)
self._success_profile = Profile(fg="green")
self._error_profile = Profile(fg="red", dim=True)
self._detail_profile = Profile(dim=True)
# Cached messages
self._cached_message_lock = threading.Lock()
self._cached_message_text = ""
self._cache_messages = None
#
# Early initialization
#
is_a_tty = sys.stdout.isatty() and sys.stderr.isatty()
# Enable interactive mode if we're attached to a tty
if main_options["no_interactive"]:
self.interactive = False
else:
self.interactive = is_a_tty
# Handle errors interactively if we're in interactive mode
# and --on-error was not specified on the command line
if main_options.get("on_error") is not None:
self._interactive_failures = False
else:
self._interactive_failures = self.interactive
# Use color output if we're attached to a tty, unless
# otherwise specified on the command line
if main_options["colors"] is None:
self.colors = is_a_tty
elif main_options["colors"]:
self.colors = True
else:
self.colors = False
if main_options["directory"]:
self._set_project_dir = True
else:
main_options["directory"] = os.getcwd()