summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbst-marge-bot <marge-bot@buildstream.build>2019-03-01 19:04:30 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-03-01 19:04:30 +0000
commit8f9b3dcdaca6f5179b79328b17b3e2c71db19e73 (patch)
tree90a0a943f1a0565220032fdc5c7a789de88a51a8
parent1eba1fed210d9814a06ef2b9a24610132b18235c (diff)
parentff059b8b9852054f6669bb8bdeb6945ff0631b70 (diff)
downloadbuildstream-8f9b3dcdaca6f5179b79328b17b3e2c71db19e73.tar.gz
Merge branch 'bschubert/more-pythonic-list-concat' into 'master'
refactor: Use [a, b, *c] instead of [a, b] + c when building list See merge request BuildStream/buildstream!1200
-rw-r--r--buildstream/_gitsourcebase.py2
-rw-r--r--buildstream/plugins/sources/bzr.py2
-rw-r--r--buildstream/plugins/sources/local.py2
-rw-r--r--buildstream/plugins/sources/ostree.py2
-rw-r--r--buildstream/plugins/sources/pip.py10
-rw-r--r--buildstream/plugintestutils/runcli.py3
-rw-r--r--buildstream/sandbox/_sandboxremote.py8
-rw-r--r--tests/frontend/buildcheckout.py2
-rw-r--r--tests/frontend/logging.py2
-rw-r--r--tests/frontend/rebuild.py2
-rw-r--r--tests/frontend/show.py4
-rw-r--r--tests/frontend/source_checkout.py2
-rw-r--r--tests/frontend/workspace.py16
-rw-r--r--tests/integration/shell.py2
-rw-r--r--tests/integration/source-determinism.py2
-rw-r--r--tests/sources/git.py6
-rw-r--r--tests/sources/previous_source_access/plugins/sources/foo_transform.py2
-rw-r--r--tests/sources/tar.py2
18 files changed, 37 insertions, 34 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:
diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py
index e7f67fa91..af34e6d67 100644
--- a/tests/frontend/buildcheckout.py
+++ b/tests/frontend/buildcheckout.py
@@ -21,7 +21,7 @@ DATA_DIR = os.path.join(
def strict_args(args, strict):
if strict != "strict":
- return ['--no-strict'] + args
+ return ['--no-strict', *args]
return args
diff --git a/tests/frontend/logging.py b/tests/frontend/logging.py
index 17d925cd1..58ac4eeba 100644
--- a/tests/frontend/logging.py
+++ b/tests/frontend/logging.py
@@ -101,7 +101,7 @@ def test_failed_build_listing(cli, tmpdir, datafiles):
}
_yaml.dump(element, os.path.join(project, element_path))
element_names.append(element_name)
- result = cli.run(project=project, args=['--on-error=continue', 'build'] + element_names)
+ result = cli.run(project=project, args=['--on-error=continue', 'build', *element_names])
result.assert_main_error(ErrorDomain.STREAM, None)
failure_heading_pos = re.search(r'^Failure Summary$', result.stderr, re.MULTILINE).start()
diff --git a/tests/frontend/rebuild.py b/tests/frontend/rebuild.py
index 6a46e855e..21f21fae3 100644
--- a/tests/frontend/rebuild.py
+++ b/tests/frontend/rebuild.py
@@ -11,7 +11,7 @@ DATA_DIR = os.path.join(
def strict_args(args, strict):
if strict != "strict":
- return ['--no-strict'] + args
+ return ['--no-strict', *args]
return args
diff --git a/tests/frontend/show.py b/tests/frontend/show.py
index ac1edebd6..73cda9108 100644
--- a/tests/frontend/show.py
+++ b/tests/frontend/show.py
@@ -181,7 +181,7 @@ def test_parallel_order(cli, tmpdir, datafiles):
elements = ['multiple_targets/order/0.bst',
'multiple_targets/order/1.bst']
- args = ['show', '-d', 'plan', '-f', '%{name}'] + elements
+ args = ['show', '-d', 'plan', '-f', '%{name}', *elements]
result = cli.run(project=project, args=args)
result.assert_success()
@@ -210,7 +210,7 @@ def test_target_is_dependency(cli, tmpdir, datafiles):
elements = ['multiple_targets/dependency/zebry.bst',
'multiple_targets/dependency/horsey.bst']
- args = ['show', '-d', 'plan', '-f', '%{name}'] + elements
+ args = ['show', '-d', 'plan', '-f', '%{name}', *elements]
result = cli.run(project=project, args=args)
result.assert_success()
diff --git a/tests/frontend/source_checkout.py b/tests/frontend/source_checkout.py
index b41d32491..1a83ba76e 100644
--- a/tests/frontend/source_checkout.py
+++ b/tests/frontend/source_checkout.py
@@ -50,7 +50,7 @@ def test_source_checkout(datafiles, cli, tmpdir_factory, with_workspace, guess_e
else:
ws_cmd = []
- args = ws_cmd + ['source', 'checkout', '--deps', 'none'] + elm_cmd + [checkout]
+ args = ws_cmd + ['source', 'checkout', '--deps', 'none', *elm_cmd, checkout]
result = cli.run(project=project, args=args)
result.assert_success()
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 91004b9f4..7ca8064b8 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -657,14 +657,14 @@ def test_build(cli, tmpdir_factory, datafiles, kind, strict, from_workspace, gue
# Build modified workspace
assert cli.get_element_state(project, element_name) == 'buildable'
assert cli.get_element_key(project, element_name) == "{:?<64}".format('')
- result = cli.run(project=project, args=args_dir + ['build'] + args_elm)
+ result = cli.run(project=project, args=args_dir + ['build', *args_elm])
result.assert_success()
assert cli.get_element_state(project, element_name) == 'cached'
assert cli.get_element_key(project, element_name) != "{:?<64}".format('')
# Checkout the result
result = cli.run(project=project,
- args=args_dir + ['artifact', 'checkout', '--directory', checkout] + args_elm)
+ args=args_dir + ['artifact', 'checkout', '--directory', checkout, *args_elm])
result.assert_success()
# Check that the pony.conf from the modified workspace exists
@@ -1101,7 +1101,7 @@ def test_external_fetch(cli, datafiles, tmpdir_factory, subdir, guess_element):
assert cli.get_element_state(str(datafiles), depend_element) == 'fetch needed'
# Fetch the workspaced element
- result = cli.run(project=project, args=['-C', call_dir, 'source', 'fetch'] + arg_elm)
+ result = cli.run(project=project, args=['-C', call_dir, 'source', 'fetch', *arg_elm])
result.assert_success()
# Assert that the depended element has now been fetched
@@ -1124,10 +1124,10 @@ def test_external_push_pull(cli, datafiles, tmpdir_factory, guess_element):
'artifacts': {'url': share.repo, 'push': True}
})
- result = cli.run(project=project, args=['-C', workspace, 'artifact', 'push'] + arg_elm)
+ result = cli.run(project=project, args=['-C', workspace, 'artifact', 'push', *arg_elm])
result.assert_success()
- result = cli.run(project=project, args=['-C', workspace, 'artifact', 'pull', '--deps', 'all'] + arg_elm)
+ result = cli.run(project=project, args=['-C', workspace, 'artifact', 'pull', '--deps', 'all', *arg_elm])
result.assert_success()
@@ -1145,7 +1145,7 @@ def test_external_track(cli, datafiles, tmpdir_factory, guess_element):
del element_contents['sources'][0]['ref']
_yaml.dump(_yaml.node_sanitize(element_contents), element_file)
- result = cli.run(project=project, args=['-C', workspace, 'source', 'track'] + arg_elm)
+ result = cli.run(project=project, args=['-C', workspace, 'source', 'track', *arg_elm])
result.assert_success()
# Element is tracked now
@@ -1198,7 +1198,7 @@ def test_external_close_self(cli, datafiles, tmpdir_factory, guess_element):
beta_element, _, beta_workspace = open_workspace(cli, tmpdir2, datafiles, "git", False, suffix="-beta")
arg_elm = [alpha_element] if not guess_element else []
- result = cli.run(project=project, args=['-C', alpha_workspace, 'workspace', 'close'] + arg_elm)
+ result = cli.run(project=project, args=['-C', alpha_workspace, 'workspace', 'close', *arg_elm])
result.assert_success()
assert 'you can no longer run BuildStream' in result.stderr
@@ -1222,7 +1222,7 @@ def test_external_reset_self(cli, datafiles, tmpdir, guess_element):
arg_elm = [element] if not guess_element else []
# Command succeeds
- result = cli.run(project=project, args=['-C', workspace, 'workspace', 'reset'] + arg_elm)
+ result = cli.run(project=project, args=['-C', workspace, 'workspace', 'reset', *arg_elm])
result.assert_success()
# Successive commands still work (i.e. .bstproject.yaml hasn't been deleted)
diff --git a/tests/integration/shell.py b/tests/integration/shell.py
index 97c4d0cad..c4fb4e961 100644
--- a/tests/integration/shell.py
+++ b/tests/integration/shell.py
@@ -40,7 +40,7 @@ def execute_shell(cli, project, command, *, config=None, mount=None, element='ba
if mount is not None:
host_path, target_path = mount
args += ['--mount', host_path, target_path]
- args += [element, '--'] + command
+ args += [element, '--', *command]
return cli.run(project=project, project_config=config, args=args)
diff --git a/tests/integration/source-determinism.py b/tests/integration/source-determinism.py
index 0b69346cd..8ab11615a 100644
--- a/tests/integration/source-determinism.py
+++ b/tests/integration/source-determinism.py
@@ -29,7 +29,7 @@ def create_test_directory(*path, mode=0o644):
@pytest.mark.integration
@pytest.mark.datafiles(DATA_DIR)
-@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS] + ['local'])
+@pytest.mark.parametrize("kind", ['local', *ALL_REPO_KINDS])
@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox')
def test_deterministic_source_umask(cli, tmpdir, datafiles, kind):
project = str(datafiles)
diff --git a/tests/sources/git.py b/tests/sources/git.py
index f3d2e2809..98891a9af 100644
--- a/tests/sources/git.py
+++ b/tests/sources/git.py
@@ -869,11 +869,11 @@ def test_git_describe(cli, tmpdir, datafiles, ref_storage, tag_type):
options = []
else:
options = ['--tags']
- describe = subprocess.check_output(['git', 'describe'] + options,
+ describe = subprocess.check_output(['git', 'describe', *options],
cwd=checkout).decode('ascii')
assert describe.startswith('tag2-2-')
- describe_fp = subprocess.check_output(['git', 'describe', '--first-parent'] + options,
+ describe_fp = subprocess.check_output(['git', 'describe', '--first-parent', *options],
cwd=checkout).decode('ascii')
assert describe_fp.startswith('tag1-2-')
@@ -979,7 +979,7 @@ def test_git_describe_head_is_tagged(cli, tmpdir, datafiles, ref_storage, tag_ty
options = []
else:
options = ['--tags']
- describe = subprocess.check_output(['git', 'describe'] + options,
+ describe = subprocess.check_output(['git', 'describe', *options],
cwd=checkout).decode('ascii')
assert describe.startswith('tag')
diff --git a/tests/sources/previous_source_access/plugins/sources/foo_transform.py b/tests/sources/previous_source_access/plugins/sources/foo_transform.py
index 7101bfd24..820946454 100644
--- a/tests/sources/previous_source_access/plugins/sources/foo_transform.py
+++ b/tests/sources/previous_source_access/plugins/sources/foo_transform.py
@@ -30,7 +30,7 @@ class FooTransformSource(Source):
return path
def configure(self, node):
- self.node_validate(node, ['ref'] + Source.COMMON_CONFIG_KEYS)
+ self.node_validate(node, ['ref', *Source.COMMON_CONFIG_KEYS])
self.ref = self.node_get_member(node, str, 'ref', None)
def preflight(self):
diff --git a/tests/sources/tar.py b/tests/sources/tar.py
index 959ff890c..9284a25a3 100644
--- a/tests/sources/tar.py
+++ b/tests/sources/tar.py
@@ -377,7 +377,7 @@ def test_netrc_already_specified_user(cli, datafiles, server_type, tmpdir):
with create_file_server(server_type) as server:
server.add_user('otheruser', '12345', file_server_files)
parts = urllib.parse.urlsplit(server.base_url())
- base_url = urllib.parse.urlunsplit([parts[0]] + ['otheruser@{}'.format(parts[1])] + list(parts[2:]))
+ base_url = urllib.parse.urlunsplit([parts[0], 'otheruser@{}'.format(parts[1]), *parts[2:]])
generate_project_file_server(base_url, project)
src_tar = os.path.join(file_server_files, 'a.tar.gz')