diff options
author | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-03-01 11:11:15 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-01 18:28:36 +0000 |
commit | ff059b8b9852054f6669bb8bdeb6945ff0631b70 (patch) | |
tree | 90a0a943f1a0565220032fdc5c7a789de88a51a8 /buildstream | |
parent | 1eba1fed210d9814a06ef2b9a24610132b18235c (diff) | |
download | buildstream-bschubert/more-pythonic-list-concat.tar.gz |
Use [a, b, *c] instead of [a, b] + c when building listbschubert/more-pythonic-list-concat
This pattern is available from python3.5 and provides a simpler
understanding of what is going on
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_gitsourcebase.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/sources/bzr.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/sources/local.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/sources/ostree.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/sources/pip.py | 10 | ||||
-rw-r--r-- | buildstream/plugintestutils/runcli.py | 3 | ||||
-rw-r--r-- | buildstream/sandbox/_sandboxremote.py | 8 |
7 files changed, 16 insertions, 13 deletions
diff --git a/buildstream/_gitsourcebase.py b/buildstream/_gitsourcebase.py index b986f7543..c0913409c 100644 --- a/buildstream/_gitsourcebase.py +++ b/buildstream/_gitsourcebase.py @@ -171,7 +171,7 @@ class GitMirror(SourceFetcher): tags = set() for options in [[], ['--first-parent'], ['--tags'], ['--tags', '--first-parent']]: exit_code, output = self.source.check_output( - [self.source.host_git, 'describe', '--abbrev=0', ref] + options, + [self.source.host_git, 'describe', '--abbrev=0', ref, *options], cwd=self.mirror) if exit_code == 0: tag = output.strip() diff --git a/buildstream/plugins/sources/bzr.py b/buildstream/plugins/sources/bzr.py index de5dbdcc7..e59986da6 100644 --- a/buildstream/plugins/sources/bzr.py +++ b/buildstream/plugins/sources/bzr.py @@ -67,7 +67,7 @@ class BzrSource(Source): # pylint: disable=attribute-defined-outside-init def configure(self, node): - self.node_validate(node, ['url', 'track', 'ref'] + Source.COMMON_CONFIG_KEYS) + self.node_validate(node, ['url', 'track', 'ref', *Source.COMMON_CONFIG_KEYS]) self.original_url = self.node_get_member(node, str, 'url') self.tracking = self.node_get_member(node, str, 'track') diff --git a/buildstream/plugins/sources/local.py b/buildstream/plugins/sources/local.py index bdda91e2f..50df85427 100644 --- a/buildstream/plugins/sources/local.py +++ b/buildstream/plugins/sources/local.py @@ -52,7 +52,7 @@ class LocalSource(Source): self.__unique_key = None def configure(self, node): - self.node_validate(node, ['path'] + Source.COMMON_CONFIG_KEYS) + self.node_validate(node, ['path', *Source.COMMON_CONFIG_KEYS]) self.path = self.node_get_project_path(node, 'path') self.fullpath = os.path.join(self.get_project_directory(), self.path) diff --git a/buildstream/plugins/sources/ostree.py b/buildstream/plugins/sources/ostree.py index 770cfd55f..23115090f 100644 --- a/buildstream/plugins/sources/ostree.py +++ b/buildstream/plugins/sources/ostree.py @@ -64,7 +64,7 @@ class OSTreeSource(Source): def configure(self, node): - self.node_validate(node, ['url', 'ref', 'track', 'gpg-key'] + Source.COMMON_CONFIG_KEYS) + self.node_validate(node, ['url', 'ref', 'track', 'gpg-key', *Source.COMMON_CONFIG_KEYS]) self.original_url = self.node_get_member(node, str, 'url') self.url = self.translate_url(self.original_url) diff --git a/buildstream/plugins/sources/pip.py b/buildstream/plugins/sources/pip.py index abef1fd0d..9d6c40d74 100644 --- a/buildstream/plugins/sources/pip.py +++ b/buildstream/plugins/sources/pip.py @@ -182,10 +182,12 @@ class PipSource(Source): packages = self.ref.strip().split('\n') package_dir = os.path.join(tmpdir, 'packages') os.makedirs(package_dir) - self.call(self.host_pip + ['download', - '--no-binary', ':all:', - '--index-url', self.index_url, - '--dest', package_dir] + packages, + self.call([*self.host_pip, + 'download', + '--no-binary', ':all:', + '--index-url', self.index_url, + '--dest', package_dir, + *packages], fail="Failed to install python packages: {}".format(packages)) # If the mirror directory already exists, assume that some other diff --git a/buildstream/plugintestutils/runcli.py b/buildstream/plugintestutils/runcli.py index 79d42ec1f..5dbecdd60 100644 --- a/buildstream/plugintestutils/runcli.py +++ b/buildstream/plugintestutils/runcli.py @@ -433,7 +433,8 @@ class Cli(): 'show', '--deps', deps, '--format', '%{name}||%{state}', - ] + targets) + *targets + ]) result.assert_success() lines = result.output.splitlines() states = {} diff --git a/buildstream/sandbox/_sandboxremote.py b/buildstream/sandbox/_sandboxremote.py index 81702743a..38fc170f4 100644 --- a/buildstream/sandbox/_sandboxremote.py +++ b/buildstream/sandbox/_sandboxremote.py @@ -123,7 +123,7 @@ class SandboxRemote(Sandbox): service_keys = ['execution-service', 'storage-service', 'action-cache-service'] - _yaml.node_validate(remote_config, ['url'] + service_keys) + _yaml.node_validate(remote_config, ['url', *service_keys]) exec_config = require_node(remote_config, 'execution-service') storage_config = require_node(remote_config, 'storage-service') @@ -131,10 +131,10 @@ class SandboxRemote(Sandbox): tls_keys = ['client-key', 'client-cert', 'server-cert'] - _yaml.node_validate(exec_config, ['url', 'instance-name'] + tls_keys) - _yaml.node_validate(storage_config, ['url', 'instance-name'] + tls_keys) + _yaml.node_validate(exec_config, ['url', 'instance-name', *tls_keys]) + _yaml.node_validate(storage_config, ['url', 'instance-name', *tls_keys]) if action_config: - _yaml.node_validate(action_config, ['url', 'instance-name'] + tls_keys) + _yaml.node_validate(action_config, ['url', 'instance-name', *tls_keys]) # Maintain some backwards compatibility with older configs, in which # 'url' was the only valid key for remote-execution: |