summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2021-04-06 10:17:58 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2021-05-22 11:51:21 -0700
commitfb27c7ad0c5542c10de98de6c825fbd0c7c8a88f (patch)
tree15fc8e9ffe7ff4ed5ee47bd47d68e8b41a6a4bb6 /lib
parent4a7581eda346389cf11bb427b488d71340b5527b (diff)
downloadspack-fb27c7ad0c5542c10de98de6c825fbd0c7c8a88f.tar.gz
spack-fb27c7ad0c5542c10de98de6c825fbd0c7c8a88f.tar.bz2
spack-fb27c7ad0c5542c10de98de6c825fbd0c7c8a88f.tar.xz
spack-fb27c7ad0c5542c10de98de6c825fbd0c7c8a88f.zip
spack location: fix usage without args (#22755)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/location.py7
-rw-r--r--lib/spack/spack/test/cmd/location.py2
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/spack/spack/cmd/location.py b/lib/spack/spack/cmd/location.py
index d26587c8c4..3b72de978b 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 9c47c2253a..2cefbd558f 100644
--- a/lib/spack/spack/test/cmd/location.py
+++ b/lib/spack/spack/test/cmd/location.py
@@ -52,10 +52,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():