diff options
author | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-07-16 18:31:19 +0100 |
---|---|---|
committer | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-07-16 18:32:48 +0100 |
commit | f2ece705b7bf36d7d923264af2b1f51b66a9f9a7 (patch) | |
tree | 7df4a79b12013f6094371e86bcf52bb6aa8719e7 /src/buildstream/element.py | |
parent | fbb8eea8334023e30c8719cb52f9b0e226b4eb8b (diff) | |
download | buildstream-bschubert/api-improvements.tar.gz |
node: Add 'get_str_list' on 'MappingNode'bschubert/api-improvements
`mapping.get_sequence(...).as_str_list()` is a very common
pattern seen both in plugins and the core. Adding a helper to reduce
the number of operations will make usage smoother
Diffstat (limited to 'src/buildstream/element.py')
-rw-r--r-- | src/buildstream/element.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 5856f3241..af171621c 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -816,7 +816,7 @@ class Element(Plugin): if bstdata is not None: with sandbox.batch(SandboxFlags.NONE): - commands = bstdata.get_sequence('integration-commands', []).as_str_list() + commands = bstdata.get_str_list('integration-commands', []) for command in commands: cmd = self.substitute_variables(command) @@ -2624,7 +2624,7 @@ class Element(Plugin): else: project_nocache = project.base_env_nocache - default_nocache = cls.__defaults.get_sequence('environment-nocache', default=[]).as_str_list() + default_nocache = cls.__defaults.get_str_list('environment-nocache', default=[]) element_nocache = meta.env_nocache # Accumulate values from the element default, the project and the element @@ -2866,7 +2866,7 @@ class Element(Plugin): # If this ever changes, things will go wrong unexpectedly. if not self.__whitelist_regex: bstdata = self.get_public_data('bst') - whitelist = bstdata.get_sequence('overlap-whitelist', default=[]).as_str_list() + whitelist = bstdata.get_str_list('overlap-whitelist', default=[]) whitelist_expressions = [utils._glob2re(self.__variables.subst(exp.strip())) for exp in whitelist] expression = ('^(?:' + '|'.join(whitelist_expressions) + ')$') self.__whitelist_regex = re.compile(expression) |