summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Invernizzi <9337627+albestro@users.noreply.github.com>2022-05-15 12:13:42 +0200
committerMassimiliano Culpo <massimiliano.culpo@gmail.com>2022-07-14 16:47:26 +0200
commit5cea962e8e39c776faf5475d54b658edcbf471d1 (patch)
treeb291304b8756217b2de676b60282c81dd27f3cac
parentb9fa27ac654e637a3f88c891e26cc207d08d1372 (diff)
downloadspack-5cea962e8e39c776faf5475d54b658edcbf471d1.tar.gz
spack-5cea962e8e39c776faf5475d54b658edcbf471d1.tar.bz2
spack-5cea962e8e39c776faf5475d54b658edcbf471d1.tar.xz
spack-5cea962e8e39c776faf5475d54b658edcbf471d1.zip
Fix for `spack stage` command not extracting packages in custom paths (#30448)
-rw-r--r--lib/spack/spack/cmd/stage.py10
-rw-r--r--lib/spack/spack/test/cmd/stage.py1
2 files changed, 4 insertions, 7 deletions
diff --git a/lib/spack/spack/cmd/stage.py b/lib/spack/spack/cmd/stage.py
index 8903cb83e5..7527e60248 100644
--- a/lib/spack/spack/cmd/stage.py
+++ b/lib/spack/spack/cmd/stage.py
@@ -27,12 +27,6 @@ def setup_parser(subparser):
def stage(parser, args):
- # We temporarily modify the working directory when setting up a stage, so we need to
- # convert this to an absolute path here in order for it to remain valid later.
- custom_path = os.path.abspath(args.path) if args.path else None
- if custom_path:
- spack.stage.create_stage_root(custom_path)
-
if not args.specs:
env = ev.active_environment()
if env:
@@ -54,6 +48,10 @@ def stage(parser, args):
specs = spack.cmd.parse_specs(args.specs, concretize=False)
+ # We temporarily modify the working directory when setting up a stage, so we need to
+ # convert this to an absolute path here in order for it to remain valid later.
+ custom_path = os.path.abspath(args.path) if args.path else None
+
# prevent multiple specs from extracting in the same folder
if len(specs) > 1 and custom_path:
tty.die("`--path` requires a single spec, but multiple were provided")
diff --git a/lib/spack/spack/test/cmd/stage.py b/lib/spack/spack/test/cmd/stage.py
index bf590b0ea6..7b5dafa64e 100644
--- a/lib/spack/spack/test/cmd/stage.py
+++ b/lib/spack/spack/test/cmd/stage.py
@@ -39,7 +39,6 @@ def check_stage_path(monkeypatch, tmpdir):
def fake_stage(pkg, mirror_only=False):
assert pkg.path == expected_path
- assert os.path.isdir(expected_path), expected_path
monkeypatch.setattr(spack.package.PackageBase, 'do_stage', fake_stage)