blob: 723f89ce08ef6775b1f8d7cca924c75c44726f39 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from __future__ import print_function
import sys
from llnl.util.tty.colify import colify
import llnl.util.tty as tty
import spack.cmd.common.arguments as arguments
import spack.repo
description = "list available versions of a package"
section = "packaging"
level = "long"
def setup_parser(subparser):
subparser.add_argument('-s', '--safe-only', action='store_true',
help='only list safe versions of the package')
arguments.add_common_arguments(subparser, ['package'])
def versions(parser, args):
pkg = spack.repo.get(args.package)
if sys.stdout.isatty():
tty.msg('Safe versions (already checksummed):')
safe_versions = pkg.versions
if not safe_versions:
if sys.stdout.isatty():
tty.warn('Found no versions for {0}'.format(pkg.name))
tty.debug('Manually add versions to the package.')
else:
colify(sorted(safe_versions, reverse=True), indent=2)
if args.safe_only:
return
if sys.stdout.isatty():
tty.msg('Remote versions (not yet checksummed):')
fetched_versions = pkg.fetch_remote_versions()
remote_versions = set(fetched_versions).difference(safe_versions)
if not remote_versions:
if sys.stdout.isatty():
if not fetched_versions:
tty.warn('Found no versions for {0}'.format(pkg.name))
tty.debug('Check the list_url and list_depth attributes of '
'the package to help Spack find versions.')
else:
tty.warn('Found no unchecksummed versions for {0}'.format(
pkg.name))
else:
colify(sorted(remote_versions, reverse=True), indent=2)
|