diff options
author | Harmen Stoppels <harmenstoppels@gmail.com> | 2021-03-17 15:38:14 +0100 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2021-05-22 11:51:20 -0700 |
commit | 61e619bb27428c43697ad8447fe761b486e798cb (patch) | |
tree | 25632b68f913b4f3a304390f0971d126f83e9ae9 /lib | |
parent | 4d148a430e77a9d7842f3c02797e760dd87c8f63 (diff) | |
download | spack-61e619bb27428c43697ad8447fe761b486e798cb.tar.gz spack-61e619bb27428c43697ad8447fe761b486e798cb.tar.bz2 spack-61e619bb27428c43697ad8447fe761b486e798cb.tar.xz spack-61e619bb27428c43697ad8447fe761b486e798cb.zip |
spack location: bugfix for out of source build dirs (#22348)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/location.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/spack/spack/cmd/location.py b/lib/spack/spack/cmd/location.py index 60978fe404..cced5d29a0 100644 --- a/lib/spack/spack/cmd/location.py +++ b/lib/spack/spack/cmd/location.py @@ -110,4 +110,16 @@ def location(parser, args): tty.die("Build directory does not exist yet. " "Run this to create it:", "spack stage " + " ".join(args.spec)) - print(pkg.stage.source_path) + + # Out of source builds have build_directory defined + if hasattr(pkg, '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 + ))) + else: + # Otherwise assume in-source builds + return print(pkg.stage.source_path) |