diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-02-23 19:53:16 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-02-23 22:14:53 +0900 |
commit | d009896148460a002e5a950a13ba24c80c36a858 (patch) | |
tree | 881033ed63204ec5532922dd4deb59950fb2f928 | |
parent | 7b5858c1783730ea1e31adafb982e7b0edcefcf9 (diff) | |
download | buildstream-d009896148460a002e5a950a13ba24c80c36a858.tar.gz |
_project.py: Parse the new 'shell' section
This section informs BuildStream how to launch interactive shells
for the specific project.
Initial options include:
o Default shell command to run for an interactive shell, this is
used for interactive debugging sessions, and also if no command
was specified in `bst shell`
o List of environment variables to inherit from user environment,
this is useful to propagate some host stuff into the environment
for debugging; and only considered when it is not an "isolated"
shell.
-rw-r--r-- | buildstream/_project.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/buildstream/_project.py b/buildstream/_project.py index cb19b55e3..fd11b86be 100644 --- a/buildstream/_project.py +++ b/buildstream/_project.py @@ -79,6 +79,10 @@ class Project(): self._element_format_versions = {} self._fail_on_overlap = False + # Shell options + self._shell_command = [] # The default interactive shell command + self._shell_inherit_env = [] # Environment vars to inherit when non-isolated + profile_start(Topics.LOAD_PROJECT, self.directory.replace(os.sep, '-')) self._load() profile_end(Topics.LOAD_PROJECT, self.directory.replace(os.sep, '-')) @@ -139,7 +143,7 @@ class Project(): 'split-rules', 'elements', 'plugins', 'aliases', 'name', 'artifacts', 'options', - 'fail-on-overlap' + 'fail-on-overlap', 'shell' ]) # The project name, element path and option declarations @@ -269,6 +273,14 @@ class Project(): self._fail_on_overlap = _yaml.node_get(config, bool, 'fail-on-overlap', default_value=False) + # Parse shell options + shell_options = _yaml.node_get(config, Mapping, 'shell', default_value={}) + _yaml.node_validate(shell_options, ['command', 'inherit-environment']) + self._shell_command = _yaml.node_get(shell_options, list, 'command', + default_value=['sh', '-i']) + self._shell_inherit_env = _yaml.node_get(shell_options, list, 'inherit-environment', + default_value=[]) + # _store_origin() # # Helper function to store plugin origins |