diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2014-08-21 22:59:39 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2014-08-21 22:59:39 -0700 |
commit | eb5efed421783dddbc6ebfe4ee7a9a987dfda3a5 (patch) | |
tree | 384c9057f63cb4a9d49a57e94acb2ec9b3e22d30 /lib | |
parent | 5a9ef130ea51f02a486b18f7173b980f3a539440 (diff) | |
parent | e301d623329d3f484316643c6a50dc3df4806dab (diff) | |
download | spack-eb5efed421783dddbc6ebfe4ee7a9a987dfda3a5.tar.gz spack-eb5efed421783dddbc6ebfe4ee7a9a987dfda3a5.tar.bz2 spack-eb5efed421783dddbc6ebfe4ee7a9a987dfda3a5.tar.xz spack-eb5efed421783dddbc6ebfe4ee7a9a987dfda3a5.zip |
Merge branch 'features/postgresql' into develop
- add spack cd command.
- Fix bug in modules hook
Conflicts:
lib/spack/spack/cmd/stage.py
lib/spack/spack/hooks/dotkit.py
share/spack/setup-env.bash
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/__init__.py | 41 | ||||
-rw-r--r-- | lib/spack/spack/cmd/stage.py | 41 | ||||
-rw-r--r-- | lib/spack/spack/hooks/tclmodule.py | 4 |
3 files changed, 60 insertions, 26 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py index ab8978cecf..bf91a885ca 100644 --- a/lib/spack/spack/__init__.py +++ b/lib/spack/spack/__init__.py @@ -22,20 +22,6 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## - -# -# When packages call 'from spack import *', this is what is brought in. -# -# Spack internal code calls 'import spack' and accesses other -# variables (spack.db, paths, etc.) directly. -# -# TODO: maybe this should be separated out and should go in build_environment.py? -# TODO: it's not clear where all the stuff that needs to be included in packages -# should live. This file is overloaded for spack core vs. for packages. -__all__ = ['Package', 'when', 'provides', 'depends_on', 'version', - 'patch', 'Version', 'working_dir', 'which', 'Executable', - 'filter_file', 'change_sed_delimiter'] - import os import tempfile from llnl.util.filesystem import * @@ -140,11 +126,30 @@ do_checksum = True # sys_type = None + +# +# When packages call 'from spack import *', this extra stuff is brought in. +# +# Spack internal code should call 'import spack' and accesses other +# variables (spack.db, paths, etc.) directly. # -# Extra imports that should be generally usable from package.py files. +# TODO: maybe this should be separated out and should go in build_environment.py? +# TODO: it's not clear where all the stuff that needs to be included in packages +# should live. This file is overloaded for spack core vs. for packages. # -from llnl.util.filesystem import working_dir +__all__ = ['Package', 'Version', 'when'] from spack.package import Package -from spack.relations import * -from spack.multimethod import when from spack.version import Version +from spack.multimethod import when + +import llnl.util.filesystem +from llnl.util.filesystem import * +__all__ += llnl.util.filesystem.__all__ + +import spack.relations +from spack.relations import * +__all__ += spack.relations.__all__ + +import spack.util.executable +from spack.util.executable import * +__all__ += spack.util.executable.__all__ diff --git a/lib/spack/spack/cmd/stage.py b/lib/spack/spack/cmd/stage.py index 2673cdc266..5df0ffc2a5 100644 --- a/lib/spack/spack/cmd/stage.py +++ b/lib/spack/spack/cmd/stage.py @@ -22,8 +22,10 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## +import os from external import argparse +import llnl.util.tty as tty import spack import spack.cmd @@ -33,18 +35,45 @@ def setup_parser(subparser): subparser.add_argument( '-n', '--no-checksum', action='store_true', dest='no_checksum', help="Do not check downloaded packages against checksum") + + dir_parser = subparser.add_mutually_exclusive_group() + dir_parser.add_argument( + '-d', '--print-stage-dir', action='store_const', dest='print_dir', + const='print_stage', help="Prints out the stage directory for a spec.") + dir_parser.add_argument( + '-b', '--print-build-dir', action='store_const', dest='print_dir', + const='print_build', help="Prints out the expanded archive path for a spec.") + subparser.add_argument( - 'packages', nargs=argparse.REMAINDER, help="specs of packages to stage") + 'specs', nargs=argparse.REMAINDER, help="specs of packages to stage") def stage(parser, args): - if not args.packages: + if not args.specs: tty.die("stage requires at least one package argument") if args.no_checksum: spack.do_checksum = False - specs = spack.cmd.parse_specs(args.packages, concretize=True) - for spec in specs: - package = spack.db.get(spec) - package.do_stage() + specs = spack.cmd.parse_specs(args.specs, concretize=True) + + if args.print_dir: + if len(specs) != 1: + tty.die("--print-stage-dir and --print-build-dir options only take one spec.") + + spec = specs[0] + pkg = spack.db.get(spec) + + if args.print_dir == 'print_stage': + print pkg.stage.path + elif args.print_dir == 'print_build': + if not os.listdir(pkg.stage.path): + tty.die("Stage directory is empty. Run this first:", + "spack stage " + " ".join(args.specs)) + print pkg.stage.expanded_archive_path + + else: + for spec in specs: + package = spack.db.get(spec) + package.do_stage() + diff --git a/lib/spack/spack/hooks/tclmodule.py b/lib/spack/spack/hooks/tclmodule.py index d93da3177e..0b9fd5a67c 100644 --- a/lib/spack/spack/hooks/tclmodule.py +++ b/lib/spack/spack/hooks/tclmodule.py @@ -26,10 +26,10 @@ import spack.modules def post_install(pkg): - dk = spack.modules.TclModule(pkg) + dk = spack.modules.TclModule(pkg.spec) dk.write() def post_uninstall(pkg): - dk = spack.modules.TclModule(pkg) + dk = spack.modules.TclModule(pkg.spec) dk.remove() |