From 3fd9fc89941a6bd247d125c07f34f16f3ac58429 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 14 Oct 2018 16:49:40 -0700 Subject: env: `spack env install` automatically concretizes specs --- lib/spack/spack/cmd/env.py | 12 +++++++++++- lib/spack/spack/environment.py | 10 +++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/spack/spack/cmd/env.py b/lib/spack/spack/cmd/env.py index 265139a09f..df26e9ece7 100644 --- a/lib/spack/spack/cmd/env.py +++ b/lib/spack/spack/cmd/env.py @@ -353,14 +353,24 @@ def _env_concretize(env, use_repo=False, force=False): # env install # def env_install_setup_parser(subparser): - """install all concretized specs in an environment""" + """concretize and install all specs in an environment""" subparser.add_argument( 'env', nargs='?', help='install all packages in this environment') + subparser.add_argument( + '--only-concrete', action='store_true', default=False, + help='only install already concretized specs') spack.cmd.install.add_common_arguments(subparser) def env_install(args): env = get_env(args, 'status') + + # concretize unless otherwise specified + if not args.only_concrete: + env.concretize() + env.write() + + # install all specs in the environment env.install(args) diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py index ab4d464d4c..fd21ece9e1 100644 --- a/lib/spack/spack/environment.py +++ b/lib/spack/spack/environment.py @@ -425,9 +425,8 @@ class Environment(object): # return only the newly concretized specs return new_specs - def install(self, install_args=None): - """Do a `spack install` on all the (concretized) - specs in an Environment.""" + def install(self, args=None): + """Install all concretized specs in an environment.""" # Make sure log directory exists logs_dir = log_path(self.dotenv_path) @@ -439,8 +438,9 @@ class Environment(object): # Parse cli arguments and construct a dictionary # that will be passed to Package.do_install API kwargs = dict() - if install_args: - spack.cmd.install.update_kwargs_from_args(install_args, kwargs) + if args: + spack.cmd.install.update_kwargs_from_args(args, kwargs) + with fs.working_dir(self.path): spec.package.do_install(**kwargs) -- cgit v1.2.3-60-g2f50