Compare commits
1 Commits
develop
...
force-ever
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0ffeaa51d6 |
@ -504,11 +504,22 @@ class ConfigSetAction(argparse.Action):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, option_strings, dest, const, default=None, required=False, help=None, metavar=None
|
self,
|
||||||
|
option_strings,
|
||||||
|
dest,
|
||||||
|
const,
|
||||||
|
default=None,
|
||||||
|
required=False,
|
||||||
|
help=None,
|
||||||
|
metavar=None,
|
||||||
|
require_environment=False,
|
||||||
):
|
):
|
||||||
# save the config option we're supposed to set
|
# save the config option we're supposed to set
|
||||||
self.config_path = dest
|
self.config_path = dest
|
||||||
|
|
||||||
|
# save whether the option requires an active env
|
||||||
|
self.require_environment = require_environment
|
||||||
|
|
||||||
# destination is translated to a legal python identifier by
|
# destination is translated to a legal python identifier by
|
||||||
# substituting '_' for ':'.
|
# substituting '_' for ':'.
|
||||||
dest = dest.replace(":", "_")
|
dest = dest.replace(":", "_")
|
||||||
@ -524,6 +535,11 @@ def __init__(
|
|||||||
)
|
)
|
||||||
|
|
||||||
def __call__(self, parser, namespace, values, option_string):
|
def __call__(self, parser, namespace, values, option_string):
|
||||||
|
if self.require_environment and not ev.active_environment():
|
||||||
|
raise argparse.ArgumentTypeError(
|
||||||
|
f"argument '{self.option_strings[-1]}' requires an environment"
|
||||||
|
)
|
||||||
|
|
||||||
# Retrieve the name of the config option and set it to
|
# Retrieve the name of the config option and set it to
|
||||||
# the const from the constructor or a value from the CLI.
|
# the const from the constructor or a value from the CLI.
|
||||||
# Note that this is only called if the argument is actually
|
# Note that this is only called if the argument is actually
|
||||||
@ -545,6 +561,16 @@ def add_concretizer_args(subparser):
|
|||||||
Just substitute ``_`` for ``:``.
|
Just substitute ``_`` for ``:``.
|
||||||
"""
|
"""
|
||||||
subgroup = subparser.add_argument_group("concretizer arguments")
|
subgroup = subparser.add_argument_group("concretizer arguments")
|
||||||
|
subgroup.add_argument(
|
||||||
|
"-f",
|
||||||
|
"--force",
|
||||||
|
action=ConfigSetAction,
|
||||||
|
require_environment=True,
|
||||||
|
dest="concretizer:force",
|
||||||
|
const=True,
|
||||||
|
default=False,
|
||||||
|
help="allow changes to concretized specs in spack.lock (in an env)",
|
||||||
|
)
|
||||||
subgroup.add_argument(
|
subgroup.add_argument(
|
||||||
"-U",
|
"-U",
|
||||||
"--fresh",
|
"--fresh",
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
|
|
||||||
|
|
||||||
def setup_parser(subparser):
|
def setup_parser(subparser):
|
||||||
subparser.add_argument(
|
|
||||||
"-f", "--force", action="store_true", help="re-concretize even if already concretized"
|
|
||||||
)
|
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
"--test",
|
"--test",
|
||||||
default=None,
|
default=None,
|
||||||
@ -43,7 +40,7 @@ def concretize(parser, args):
|
|||||||
tests = False
|
tests = False
|
||||||
|
|
||||||
with env.write_transaction():
|
with env.write_transaction():
|
||||||
concretized_specs = env.concretize(force=args.force, tests=tests)
|
concretized_specs = env.concretize(tests=tests)
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
if concretized_specs:
|
if concretized_specs:
|
||||||
tty.msg(f"Concretized {plural(len(concretized_specs), 'spec')}:")
|
tty.msg(f"Concretized {plural(len(concretized_specs), 'spec')}:")
|
||||||
|
@ -1427,7 +1427,7 @@ def is_develop(self, spec):
|
|||||||
"""Returns true when the spec is built from local sources"""
|
"""Returns true when the spec is built from local sources"""
|
||||||
return spec.name in self.dev_specs
|
return spec.name in self.dev_specs
|
||||||
|
|
||||||
def concretize(self, force=False, tests=False):
|
def concretize(self, tests=False):
|
||||||
"""Concretize user_specs in this environment.
|
"""Concretize user_specs in this environment.
|
||||||
|
|
||||||
Only concretizes specs that haven't been concretized yet unless
|
Only concretizes specs that haven't been concretized yet unless
|
||||||
@ -1437,8 +1437,6 @@ def concretize(self, force=False, tests=False):
|
|||||||
write out a lockfile containing concretized specs.
|
write out a lockfile containing concretized specs.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
force (bool): re-concretize ALL specs, even those that were
|
|
||||||
already concretized
|
|
||||||
tests (bool or list or set): False to run no tests, True to test
|
tests (bool or list or set): False to run no tests, True to test
|
||||||
all packages, or a list of package names to run tests for some
|
all packages, or a list of package names to run tests for some
|
||||||
|
|
||||||
@ -1446,7 +1444,7 @@ def concretize(self, force=False, tests=False):
|
|||||||
List of specs that have been concretized. Each entry is a tuple of
|
List of specs that have been concretized. Each entry is a tuple of
|
||||||
the user spec and the corresponding concretized spec.
|
the user spec and the corresponding concretized spec.
|
||||||
"""
|
"""
|
||||||
if force:
|
if spack.config.get("concretizer:force", False):
|
||||||
# Clear previously concretized specs
|
# Clear previously concretized specs
|
||||||
self.concretized_user_specs = []
|
self.concretized_user_specs = []
|
||||||
self.concretized_order = []
|
self.concretized_order = []
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"force": {"type": "boolean", "default": False},
|
||||||
"reuse": {
|
"reuse": {
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
{"type": "boolean"},
|
{"type": "boolean"},
|
||||||
|
Loading…
Reference in New Issue
Block a user