Add a command to bootstrap Spack right now (#33407)
This commit is contained in:
		 Massimiliano Culpo
					Massimiliano Culpo
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							25cbb34579
						
					
				
				
					commit
					7ad7fde09c
				
			| @@ -5,6 +5,7 @@ | |||||||
| from __future__ import print_function | from __future__ import print_function | ||||||
| 
 | 
 | ||||||
| import os.path | import os.path | ||||||
|  | import platform | ||||||
| import shutil | import shutil | ||||||
| import tempfile | import tempfile | ||||||
| 
 | 
 | ||||||
| @@ -73,6 +74,8 @@ def _add_scope_option(parser): | |||||||
| def setup_parser(subparser): | def setup_parser(subparser): | ||||||
|     sp = subparser.add_subparsers(dest="subcommand") |     sp = subparser.add_subparsers(dest="subcommand") | ||||||
| 
 | 
 | ||||||
|  |     sp.add_parser("now", help="Spack ready, right now!") | ||||||
|  | 
 | ||||||
|     status = sp.add_parser("status", help="get the status of Spack") |     status = sp.add_parser("status", help="get the status of Spack") | ||||||
|     status.add_argument( |     status.add_argument( | ||||||
|         "--optional", |         "--optional", | ||||||
| @@ -404,6 +407,14 @@ def write_metadata(subdir, metadata): | |||||||
|     print(instructions) |     print(instructions) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def _now(args): | ||||||
|  |     with spack.bootstrap.ensure_bootstrap_configuration(): | ||||||
|  |         spack.bootstrap.ensure_clingo_importable_or_raise() | ||||||
|  |         spack.bootstrap.ensure_gpg_in_path_or_raise() | ||||||
|  |         if platform.system().lower() == "linux": | ||||||
|  |             spack.bootstrap.ensure_patchelf_in_path_or_raise() | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def bootstrap(parser, args): | def bootstrap(parser, args): | ||||||
|     callbacks = { |     callbacks = { | ||||||
|         "status": _status, |         "status": _status, | ||||||
| @@ -417,5 +428,6 @@ def bootstrap(parser, args): | |||||||
|         "add": _add, |         "add": _add, | ||||||
|         "remove": _remove, |         "remove": _remove, | ||||||
|         "mirror": _mirror, |         "mirror": _mirror, | ||||||
|  |         "now": _now, | ||||||
|     } |     } | ||||||
|     callbacks[args.subcommand](args) |     callbacks[args.subcommand](args) | ||||||
|   | |||||||
| @@ -412,10 +412,14 @@ _spack_bootstrap() { | |||||||
|     then |     then | ||||||
|         SPACK_COMPREPLY="-h --help" |         SPACK_COMPREPLY="-h --help" | ||||||
|     else |     else | ||||||
|         SPACK_COMPREPLY="status enable disable reset root list trust untrust add remove mirror" |         SPACK_COMPREPLY="now status enable disable reset root list trust untrust add remove mirror" | ||||||
|     fi |     fi | ||||||
| } | } | ||||||
|  |  | ||||||
|  | _spack_bootstrap_now() { | ||||||
|  |     SPACK_COMPREPLY="-h --help" | ||||||
|  | } | ||||||
|  |  | ||||||
| _spack_bootstrap_status() { | _spack_bootstrap_status() { | ||||||
|     SPACK_COMPREPLY="-h --help --optional --dev" |     SPACK_COMPREPLY="-h --help --optional --dev" | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user