diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/install.py | 23 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/install.py | 12 |
2 files changed, 26 insertions, 9 deletions
diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py index 95b195bc53..f4a4644312 100644 --- a/lib/spack/spack/cmd/install.py +++ b/lib/spack/spack/cmd/install.py @@ -348,17 +348,22 @@ environment variables: env.write(regenerate=False) specs = env.all_specs() - if not args.log_file and not reporter.filename: - reporter.filename = default_log_file(specs[0]) - reporter.specs = specs + if specs: + if not args.log_file and not reporter.filename: + reporter.filename = default_log_file(specs[0]) + reporter.specs = specs - # Tell the monitor about the specs - if args.use_monitor and specs: - monitor.new_configuration(specs) + # Tell the monitor about the specs + if args.use_monitor and specs: + monitor.new_configuration(specs) - tty.msg("Installing environment {0}".format(env.name)) - with reporter('build'): - env.install_all(**kwargs) + tty.msg("Installing environment {0}".format(env.name)) + with reporter('build'): + env.install_all(**kwargs) + + else: + msg = '{0} environment has no specs to install'.format(env.name) + tty.msg(msg) tty.debug("Regenerating environment views for {0}" .format(env.name)) diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py index 4fa022d168..2c79880088 100644 --- a/lib/spack/spack/test/cmd/install.py +++ b/lib/spack/spack/test/cmd/install.py @@ -1099,3 +1099,15 @@ def test_install_env_with_tests_root(tmpdir, mock_packages, mock_fetch, add('depb') install('--test', 'root') assert not os.path.exists(test_dep.prefix) + + +def test_install_empty_env(tmpdir, mock_packages, mock_fetch, + install_mockery, mutable_mock_env_path): + env_name = 'empty' + env('create', env_name) + with ev.read(env_name): + out = install(fail_on_error=False) + + assert env_name in out + assert 'environment' in out + assert 'no specs to install' in out |