Update Spack mirror command to match docs
This commit is contained in:
		| @@ -75,8 +75,8 @@ def mirror_add(args): | |||||||
|     if url.startswith('/'): |     if url.startswith('/'): | ||||||
|         url = 'file://' + url |         url = 'file://' + url | ||||||
|  |  | ||||||
|     mirror_dict = { args.name : url } |     newmirror = [ { args.name : url } ] | ||||||
|     spack.config.add_to_mirror_config({ args.name : url }) |     spack.config.add_to_mirror_config(newmirror) | ||||||
|  |  | ||||||
|  |  | ||||||
| def mirror_remove(args): | def mirror_remove(args): | ||||||
| @@ -90,15 +90,15 @@ def mirror_remove(args): | |||||||
|  |  | ||||||
| def mirror_list(args): | def mirror_list(args): | ||||||
|     """Print out available mirrors to the console.""" |     """Print out available mirrors to the console.""" | ||||||
|     sec_names = spack.config.get_mirror_config() |     mirrors = spack.config.get_mirror_config() | ||||||
|     if not sec_names: |     if not mirrors: | ||||||
|         tty.msg("No mirrors configured.") |         tty.msg("No mirrors configured.") | ||||||
|         return |         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) |     fmt = "%%-%ds%%s" % (max_len + 4) | ||||||
|  |  | ||||||
|     for name, val in sec_names.iteritems(): |     for name, val in mirrors: | ||||||
|         print fmt % (name, val) |         print fmt % (name, val) | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ | |||||||
| import re | import re | ||||||
| import shutil | import shutil | ||||||
| import tempfile | import tempfile | ||||||
|  | import sys | ||||||
|  |  | ||||||
| import llnl.util.tty as tty | import llnl.util.tty as tty | ||||||
| from llnl.util.filesystem import * | from llnl.util.filesystem import * | ||||||
| @@ -344,9 +345,7 @@ def destroy(self): | |||||||
|  |  | ||||||
| def _get_mirrors(): | def _get_mirrors(): | ||||||
|     """Get mirrors from spack configuration.""" |     """Get mirrors from spack configuration.""" | ||||||
|     config = spack.config.get_mirror_config() |     return [path for name, path in spack.config.get_mirror_config()] | ||||||
|     return [val for name, val in config.iteritems()] |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def ensure_access(file=spack.stage_path): | def ensure_access(file=spack.stage_path): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Matthew LeGendre
					Matthew LeGendre