Fix for spack cd -i.
This commit is contained in:
		@@ -48,6 +48,9 @@ def setup_parser(subparser):
 | 
			
		||||
    directories.add_argument(
 | 
			
		||||
        '-p', '--package-dir', action='store_true',
 | 
			
		||||
        help="Directory enclosing a spec's package.py file.")
 | 
			
		||||
    directories.add_argument(
 | 
			
		||||
        '-P', '--packages', action='store_true',
 | 
			
		||||
        help="Top-level packages directory for Spack.")
 | 
			
		||||
    directories.add_argument(
 | 
			
		||||
        '-s', '--stage-dir', action='store_true', help="Stage directory for a spec.")
 | 
			
		||||
    directories.add_argument(
 | 
			
		||||
@@ -65,21 +68,39 @@ def location(parser, args):
 | 
			
		||||
    elif args.spack_root:
 | 
			
		||||
        print spack.prefix
 | 
			
		||||
 | 
			
		||||
    elif args.packages:
 | 
			
		||||
        print spack.db.root
 | 
			
		||||
 | 
			
		||||
    else:
 | 
			
		||||
        specs = spack.cmd.parse_specs(args.spec, concretize=True)
 | 
			
		||||
        specs = spack.cmd.parse_specs(args.spec)
 | 
			
		||||
        if not specs:
 | 
			
		||||
            tty.die("You must supply a spec.")
 | 
			
		||||
        if len(specs) != 1:
 | 
			
		||||
            tty.die("Too many specs.  Need only one.")
 | 
			
		||||
            tty.die("Too many specs.  Supply only one.")
 | 
			
		||||
        spec = specs[0]
 | 
			
		||||
 | 
			
		||||
        if args.install_dir:
 | 
			
		||||
            print spec.prefix
 | 
			
		||||
            # install_dir command matches against installed specs.
 | 
			
		||||
            matching_specs = spack.db.get_installed(spec)
 | 
			
		||||
            if not matching_specs:
 | 
			
		||||
                tty.die("Spec '%s' matches no installed packages." % spec)
 | 
			
		||||
 | 
			
		||||
            elif len(matching_specs) > 1:
 | 
			
		||||
                args =  ["%s matches multiple packages." % spec,
 | 
			
		||||
                         "Matching packages:"]
 | 
			
		||||
                args += ["  " + str(s) for s in matching_specs]
 | 
			
		||||
                args += ["Use a more specific spec."]
 | 
			
		||||
                tty.die(*args)
 | 
			
		||||
 | 
			
		||||
            print matching_specs[0].prefix
 | 
			
		||||
 | 
			
		||||
        elif args.package_dir:
 | 
			
		||||
            # This one just needs the spec name.
 | 
			
		||||
            print join_path(spack.db.root, spec.name)
 | 
			
		||||
 | 
			
		||||
        else:
 | 
			
		||||
            # These versions need concretized specs.
 | 
			
		||||
            spec.concretize()
 | 
			
		||||
            pkg = spack.db.get(spec)
 | 
			
		||||
 | 
			
		||||
            if args.stage_dir:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user