Skip to content
Snippets Groups Projects
Commit 29cce8ee authored by Eleni Mathioulaki's avatar Eleni Mathioulaki
Browse files

Merge branch 'prepare_for_fetch_cache' into 'v0.21.1_ebrains'

Prepare for fetch cache

See merge request !1
parents 6b3ed3d9 904e1a73
No related branches found
No related tags found
1 merge request!1Prepare for fetch cache
......@@ -70,6 +70,12 @@ def setup_parser(subparser):
subparser.add_argument(
"-t", "--types", action="store_true", default=False, help="show dependency types"
)
subparser.add_argument(
"--test",
default=None,
choices=["root", "all"],
help="concretize with test dependencies of only root packages or all packages",
)
arguments.add_common_arguments(subparser, ["specs"])
arguments.add_concretizer_args(subparser)
......@@ -98,9 +104,17 @@ def spec(parser, args):
# Use command line specified specs, otherwise try to use environment specs.
if args.specs:
input_specs = spack.cmd.parse_specs(args.specs)
concretized_specs = spack.cmd.parse_specs(args.specs, concretize=True)
if args.test == "all":
tests = True
elif args.test == "root":
tests = [spec.name for spec in input_specs]
else:
tests = False
concretized_specs = spack.cmd.parse_specs(args.specs, concretize=True, tests=tests)
specs = list(zip(input_specs, concretized_specs))
else:
if args.test is not None:
tty.die("spack spec for environments does not support test dependency selection")
env = ev.active_environment()
if env:
env.concretize()
......@@ -108,11 +122,16 @@ def spec(parser, args):
else:
tty.die("spack spec requires at least one spec or an active environment")
first_doc = True
for input, output in specs:
# With -y, just print YAML to output.
if args.format:
if args.format == "yaml":
# use write because to_yaml already has a newline.
if first_doc:
first_doc = False
else:
sys.stdout.write("---\n")
sys.stdout.write(output.to_yaml(hash=ht.dag_hash))
elif args.format == "json":
print(output.to_json(hash=ht.dag_hash))
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment