summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/stage.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py
index 03689c39ba..7418b5a44e 100644
--- a/lib/spack/spack/stage.py
+++ b/lib/spack/spack/stage.py
@@ -893,9 +893,9 @@ def interactive_version_filter(
"""
# Find length of longest string in the list for padding
version_filter = initial_verion_filter or VersionList([":"])
+ max_len = max(len(str(v)) for v in url_dict) if url_dict else 0
sorted_and_filtered = [v for v in url_dict if v.satisfies(version_filter)]
sorted_and_filtered.sort(reverse=True)
- max_len = max(len(str(v)) for v in sorted_and_filtered)
orig_url_dict = url_dict # only copy when using editor to modify
print_header = True
VERSION_COLOR = spack.spec.VERSION_COLOR
@@ -903,21 +903,20 @@ def interactive_version_filter(
if print_header:
has_filter = version_filter != VersionList([":"])
header = []
- if not sorted_and_filtered:
- header.append("No versions selected")
- elif len(sorted_and_filtered) == len(orig_url_dict):
+ if len(orig_url_dict) > 0 and len(sorted_and_filtered) == len(orig_url_dict):
header.append(
f"Selected {llnl.string.plural(len(sorted_and_filtered), 'version')}"
)
else:
header.append(
- f"Selected {len(sorted_and_filtered)} of {len(orig_url_dict)} versions"
+ f"Selected {len(sorted_and_filtered)} of "
+ f"{llnl.string.plural(len(orig_url_dict), 'version')}"
)
if sorted_and_filtered and known_versions:
num_new = sum(1 for v in sorted_and_filtered if v not in known_versions)
header.append(f"{llnl.string.plural(num_new, 'new version')}")
if has_filter:
- header.append(colorize(f"Filtered by {VERSION_COLOR}{version_filter}@."))
+ header.append(colorize(f"Filtered by {VERSION_COLOR}@@{version_filter}@."))
version_with_url = [
colorize(