diff options
author | Harmen Stoppels <harmenstoppels@gmail.com> | 2021-04-06 10:17:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 08:17:58 +0000 |
commit | 0fcda35a71230ec874ebd90b7dbbe8ef7d3abcac (patch) | |
tree | 6002a5b8c0cf5738b12d04bd029b85948c1cfbe0 /lib | |
parent | 8c5f4c9c94481ee980c5cac6387f80b6a3d6a23c (diff) | |
download | spack-0fcda35a71230ec874ebd90b7dbbe8ef7d3abcac.tar.gz spack-0fcda35a71230ec874ebd90b7dbbe8ef7d3abcac.tar.bz2 spack-0fcda35a71230ec874ebd90b7dbbe8ef7d3abcac.tar.xz spack-0fcda35a71230ec874ebd90b7dbbe8ef7d3abcac.zip |
spack location: fix usage without args (#22755)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/location.py | 7 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/location.py | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/spack/spack/cmd/location.py b/lib/spack/spack/cmd/location.py index 3d0db9ab2a..9c63881be3 100644 --- a/lib/spack/spack/cmd/location.py +++ b/lib/spack/spack/cmd/location.py @@ -131,12 +131,11 @@ def location(parser, args): print(pkg.stage.source_path) return - # source and build dir remain, they require the spec to be staged + # source dir remains, which requires the spec to be staged if not pkg.stage.expanded: tty.die("Source directory does not exist yet. " "Run this to create it:", "spack stage " + " ".join(args.spec)) - if args.source_dir: - print(pkg.stage.source_path) - return + # Default to source dir. + print(pkg.stage.source_path) diff --git a/lib/spack/spack/test/cmd/location.py b/lib/spack/spack/test/cmd/location.py index 00fe46f8f0..98a13ce9da 100644 --- a/lib/spack/spack/test/cmd/location.py +++ b/lib/spack/spack/test/cmd/location.py @@ -53,10 +53,12 @@ def test_location_build_dir(mock_spec): assert location('--build-dir', spec.name).strip() == pkg.stage.source_path +@pytest.mark.regression('22738') def test_location_source_dir(mock_spec): """Tests spack location --source-dir.""" spec, pkg = mock_spec assert location('--source-dir', spec.name).strip() == pkg.stage.source_path + assert location(spec.name).strip() == pkg.stage.source_path def test_location_source_dir_missing(): |