From 207e496162f9bcef5f88ecdede3224cd9b588858 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Wed, 8 Jul 2020 02:38:42 -0500 Subject: spack create: ask how many to download (#17373) --- lib/spack/spack/cmd/checksum.py | 2 +- lib/spack/spack/cmd/create.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py index 97e7833af0..188deb1149 100644 --- a/lib/spack/spack/cmd/checksum.py +++ b/lib/spack/spack/cmd/checksum.py @@ -65,7 +65,7 @@ def checksum(parser, args): version_lines = spack.stage.get_checksums_for_versions( url_dict, pkg.name, keep_stage=args.keep_stage, - batch=(args.batch or len(args.versions) > 0), + batch=(args.batch or len(args.versions) > 0 or len(url_dict) == 1), fetch_options=pkg.fetch_options) print() diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index 7d12dc98a7..48326868ae 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -445,6 +445,9 @@ def setup_parser(subparser): subparser.add_argument( '--skip-editor', action='store_true', help="skip the edit session for the package (e.g., automation)") + subparser.add_argument( + '-b', '--batch', action='store_true', + help="don't ask which versions to checksum") class BuildSystemGuesser: @@ -511,7 +514,7 @@ class BuildSystemGuesser: # Determine the build system based on the files contained # in the archive. for pattern, bs in clues: - if any(re.search(pattern, l) for l in lines): + if any(re.search(pattern, line) for line in lines): self.build_system = bs break @@ -629,7 +632,8 @@ def get_versions(args, name): versions = spack.stage.get_checksums_for_versions( url_dict, name, first_stage_function=guesser, - keep_stage=args.keep_stage, batch=True) + keep_stage=args.keep_stage, + batch=(args.batch or len(url_dict) == 1)) else: versions = unhashed_versions -- cgit v1.2.3-60-g2f50