Style fixes for v0.16.2 release

This commit is contained in:
Massimiliano Culpo 2021-05-21 21:29:30 +02:00 committed by Todd Gamblin
parent 818664d55a
commit 80f0c78f00
8 changed files with 22 additions and 12 deletions

View file

@ -198,7 +198,9 @@ def _raise_error(executable, exe_spec):
def _bootstrap_config_scopes(): def _bootstrap_config_scopes():
tty.debug('[BOOTSTRAP CONFIG SCOPE] name=_builtin') tty.debug('[BOOTSTRAP CONFIG SCOPE] name=_builtin')
config_scopes = [ config_scopes = [
spack.config.InternalConfigScope('_builtin', spack.config.config_defaults) spack.config.InternalConfigScope(
'_builtin', spack.config.config_defaults
)
] ]
for name, path in spack.config.configuration_paths: for name, path in spack.config.configuration_paths:
platform = spack.architecture.platform().name platform = spack.architecture.platform().name

View file

@ -119,8 +119,8 @@ def location(parser, args):
if args.build_dir: if args.build_dir:
# Out of source builds have build_directory defined # Out of source builds have build_directory defined
if hasattr(pkg, 'build_directory'): if hasattr(pkg, 'build_directory'):
# build_directory can be either absolute or relative to the stage path # build_directory can be either absolute or relative to the
# in either case os.path.join makes it absolute # stage path in either case os.path.join makes it absolute
print(os.path.normpath(os.path.join( print(os.path.normpath(os.path.join(
pkg.stage.path, pkg.stage.path,
pkg.build_directory pkg.build_directory

View file

@ -492,7 +492,9 @@ def target_ranges(self, spec, single_target_fn):
def conflict_rules(self, pkg): def conflict_rules(self, pkg):
for trigger, constraints in pkg.conflicts.items(): for trigger, constraints in pkg.conflicts.items():
trigger_id = self.condition(spack.spec.Spec(trigger), name=pkg.name) trigger_id = self.condition(
spack.spec.Spec(trigger), name=pkg.name
)
self.gen.fact(fn.conflict_trigger(trigger_id)) self.gen.fact(fn.conflict_trigger(trigger_id))
for constraint, _ in constraints: for constraint, _ in constraints:

View file

@ -258,7 +258,8 @@ def use_store(store_or_path):
"""Use the store passed as argument within the context manager. """Use the store passed as argument within the context manager.
Args: Args:
store_or_path: either a Store object ot a path to where the store resides store_or_path: either a Store object ot a path to where the
store resides
Returns: Returns:
Store object associated with the context manager's store Store object associated with the context manager's store

View file

@ -39,7 +39,9 @@ def test_undevelop(tmpdir, config, mock_packages, mutable_mock_env_path):
assert not after.satisfies('dev_path=*') assert not after.satisfies('dev_path=*')
def test_undevelop_nonexistent(tmpdir, config, mock_packages, mutable_mock_env_path): def test_undevelop_nonexistent(
tmpdir, config, mock_packages, mutable_mock_env_path
):
# setup environment # setup environment
envdir = tmpdir.mkdir('env') envdir = tmpdir.mkdir('env')
with envdir.as_cwd(): with envdir.as_cwd():

View file

@ -943,7 +943,8 @@ def _source_single_file(file_and_args, environment):
concatenate_on_success, dump_environment, concatenate_on_success, dump_environment,
]) ])
output = shell( output = shell(
source_file_arguments, output=str, env=environment, ignore_quotes=True source_file_arguments, output=str, env=environment,
ignore_quotes=True
) )
environment = json.loads(output) environment = json.loads(output)

View file

@ -92,8 +92,8 @@ def __call__(self, *args, **kwargs):
ignore_errors (int or list): A list of error codes to ignore. ignore_errors (int or list): A list of error codes to ignore.
If these codes are returned, this process will not raise If these codes are returned, this process will not raise
an exception even if ``fail_on_error`` is set to ``True`` an exception even if ``fail_on_error`` is set to ``True``
ignore_quotes (bool): If False, warn users that quotes are not needed ignore_quotes (bool): If False, warn users that quotes are not
as Spack does not use a shell. Defaults to False. needed as Spack does not use a shell. Defaults to False.
input: Where to read stdin from input: Where to read stdin from
output: Where to send stdout output: Where to send stdout
error: Where to send stderr error: Where to send stderr
@ -168,12 +168,14 @@ def streamify(arg, mode):
istream, close_istream = streamify(input, 'r') istream, close_istream = streamify(input, 'r')
if not ignore_quotes: if not ignore_quotes:
quoted_args = [arg for arg in args if re.search(r'^"|^\'|"$|\'$', arg)] quoted_args = [
arg for arg in args if re.search(r'^"|^\'|"$|\'$', arg)
]
if quoted_args: if quoted_args:
tty.warn( tty.warn(
"Quotes in command arguments can confuse scripts like" "Quotes in command arguments can confuse scripts like"
" configure.", " configure.",
"The following arguments may cause problems when executed:", "These arguments may cause problems when executed:",
str("\n".join([" " + arg for arg in quoted_args])), str("\n".join([" " + arg for arg in quoted_args])),
"Quotes aren't needed because spack doesn't use a shell. " "Quotes aren't needed because spack doesn't use a shell. "
"Consider removing them.", "Consider removing them.",

View file

@ -1,4 +1,4 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)