summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2020-07-08 02:38:42 -0500
committerGitHub <noreply@github.com>2020-07-08 09:38:42 +0200
commit207e496162f9bcef5f88ecdede3224cd9b588858 (patch)
tree7533741dca7cbf1aa912cfa13e2b0e1bad22a0d8
parentf0391db096552c7dd3750b0e244d5b3930fb480d (diff)
downloadspack-207e496162f9bcef5f88ecdede3224cd9b588858.tar.gz
spack-207e496162f9bcef5f88ecdede3224cd9b588858.tar.bz2
spack-207e496162f9bcef5f88ecdede3224cd9b588858.tar.xz
spack-207e496162f9bcef5f88ecdede3224cd9b588858.zip
spack create: ask how many to download (#17373)
-rw-r--r--lib/spack/spack/cmd/checksum.py2
-rw-r--r--lib/spack/spack/cmd/create.py8
-rwxr-xr-xshare/spack/spack-completion.bash2
3 files changed, 8 insertions, 4 deletions
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
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash
index 11bd906ad0..fc1b4e2a27 100755
--- a/share/spack/spack-completion.bash
+++ b/share/spack/spack-completion.bash
@@ -639,7 +639,7 @@ _spack_containerize() {
_spack_create() {
if $list_options
then
- SPACK_COMPREPLY="-h --help --keep-stage -n --name -t --template -r --repo -N --namespace -f --force --skip-editor"
+ SPACK_COMPREPLY="-h --help --keep-stage -n --name -t --template -r --repo -N --namespace -f --force --skip-editor -b --batch"
else
SPACK_COMPREPLY=""
fi