spack location: bugfix for out of source build dirs (#22348)
This commit is contained in:
		| @@ -109,4 +109,16 @@ def location(parser, args): | |||||||
|                         tty.die("Build directory does not exist yet. " |                         tty.die("Build directory does not exist yet. " | ||||||
|                                 "Run this to create it:", |                                 "Run this to create it:", | ||||||
|                                 "spack stage " + " ".join(args.spec)) |                                 "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) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Harmen Stoppels
					Harmen Stoppels