Update Spack mirror command to match docs
This commit is contained in:
parent
987cd9e78f
commit
53cde110b1
2 changed files with 8 additions and 9 deletions
|
@ -75,8 +75,8 @@ def mirror_add(args):
|
|||
if url.startswith('/'):
|
||||
url = 'file://' + url
|
||||
|
||||
mirror_dict = { args.name : url }
|
||||
spack.config.add_to_mirror_config({ args.name : url })
|
||||
newmirror = [ { args.name : url } ]
|
||||
spack.config.add_to_mirror_config(newmirror)
|
||||
|
||||
|
||||
def mirror_remove(args):
|
||||
|
@ -90,15 +90,15 @@ def mirror_remove(args):
|
|||
|
||||
def mirror_list(args):
|
||||
"""Print out available mirrors to the console."""
|
||||
sec_names = spack.config.get_mirror_config()
|
||||
if not sec_names:
|
||||
mirrors = spack.config.get_mirror_config()
|
||||
if not mirrors:
|
||||
tty.msg("No mirrors configured.")
|
||||
return
|
||||
|
||||
max_len = max(len(s) for s in sec_names)
|
||||
max_len = max(len(name) for name,path in mirrors)
|
||||
fmt = "%%-%ds%%s" % (max_len + 4)
|
||||
|
||||
for name, val in sec_names.iteritems():
|
||||
for name, val in mirrors:
|
||||
print fmt % (name, val)
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
import re
|
||||
import shutil
|
||||
import tempfile
|
||||
import sys
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import *
|
||||
|
@ -344,9 +345,7 @@ def destroy(self):
|
|||
|
||||
def _get_mirrors():
|
||||
"""Get mirrors from spack configuration."""
|
||||
config = spack.config.get_mirror_config()
|
||||
return [val for name, val in config.iteritems()]
|
||||
|
||||
return [path for name, path in spack.config.get_mirror_config()]
|
||||
|
||||
|
||||
def ensure_access(file=spack.stage_path):
|
||||
|
|
Loading…
Reference in a new issue