summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2022-11-10 09:53:59 +0100
committerGitHub <noreply@github.com>2022-11-10 01:53:59 -0700
commitcfd0dc6d89dd54f2bbbbf053e73f9825d2f6319a (patch)
treea58b08a1f453eeeaf7cfa39a98cf637a3db6d0e2 /lib
parent60b3d32072188c6254fec32929f85af876ac968e (diff)
downloadspack-cfd0dc6d89dd54f2bbbbf053e73f9825d2f6319a.tar.gz
spack-cfd0dc6d89dd54f2bbbbf053e73f9825d2f6319a.tar.bz2
spack-cfd0dc6d89dd54f2bbbbf053e73f9825d2f6319a.tar.xz
spack-cfd0dc6d89dd54f2bbbbf053e73f9825d2f6319a.zip
spack location: fix attribute lookup after multiple build systems (#33791)
fixes #33785
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/location.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/spack/spack/cmd/location.py b/lib/spack/spack/cmd/location.py
index b5eeb92b06..0709434f2e 100644
--- a/lib/spack/spack/cmd/location.py
+++ b/lib/spack/spack/cmd/location.py
@@ -9,6 +9,7 @@ import os
import llnl.util.tty as tty
+import spack.builder
import spack.cmd
import spack.cmd.common.arguments as arguments
import spack.environment as ev
@@ -134,6 +135,7 @@ def location(parser, args):
# Either concretize or filter from already concretized environment
spec = spack.cmd.matching_spec_from_env(spec)
pkg = spec.package
+ builder = spack.builder.create(pkg)
if args.stage_dir:
print(pkg.stage.path)
@@ -141,10 +143,10 @@ def location(parser, args):
if args.build_dir:
# Out of source builds have build_directory defined
- if hasattr(pkg, "build_directory"):
+ if hasattr(builder, "build_directory"):
# build_directory can be either absolute or relative to the stage path
# in either case os.path.join makes it absolute
- print(os.path.normpath(os.path.join(pkg.stage.path, pkg.build_directory)))
+ print(os.path.normpath(os.path.join(pkg.stage.path, builder.build_directory)))
return
# Otherwise assume in-source builds