Merge branch 'bugfix/load-hooks-fix' into develop

This commit is contained in:
Todd Gamblin 2014-12-18 21:40:20 -08:00
commit 5a3a838fe5
4 changed files with 24 additions and 9 deletions

View file

@ -26,7 +26,7 @@
import tempfile import tempfile
from llnl.util.filesystem import * from llnl.util.filesystem import *
# This lives in $prefix/lib/spac/spack/__file__ # This lives in $prefix/lib/spack/spack/__file__
prefix = ancestor(__file__, 4) prefix = ancestor(__file__, 4)
# The spack script itself # The spack script itself

View file

@ -43,6 +43,9 @@ def setup_parser(subparser):
subparser.add_argument( subparser.add_argument(
'-n', '--no-checksum', action='store_true', dest='no_checksum', '-n', '--no-checksum', action='store_true', dest='no_checksum',
help="Do not check packages against checksum") help="Do not check packages against checksum")
subparser.add_argument(
'--fake', action='store_true', dest='fake',
help="Fake install. Just remove the prefix and touch a fake file in it.")
subparser.add_argument( subparser.add_argument(
'packages', nargs=argparse.REMAINDER, help="specs of packages to install") 'packages', nargs=argparse.REMAINDER, help="specs of packages to install")
@ -59,4 +62,5 @@ def install(parser, args):
package = spack.db.get(spec) package = spack.db.get(spec)
package.do_install(keep_prefix=args.keep_prefix, package.do_install(keep_prefix=args.keep_prefix,
keep_stage=args.keep_stage, keep_stage=args.keep_stage,
ignore_deps=args.ignore_deps) ignore_deps=args.ignore_deps,
fake=args.fake)

View file

@ -47,8 +47,11 @@
def all_hook_modules(): def all_hook_modules():
modules = [] modules = []
for name in list_modules(spack.hooks_path): for name in list_modules(spack.hooks_path):
mod_name = __name__ + '.' + name
path = join_path(spack.hooks_path, name) + ".py" path = join_path(spack.hooks_path, name) + ".py"
modules.append(imp.load_source('spack.hooks', path)) mod = imp.load_source(mod_name, path)
modules.append(mod)
return modules return modules

View file

@ -709,9 +709,10 @@ def do_install(self, **kwargs):
Package implementations should override install(). Package implementations should override install().
""" """
# whether to keep the prefix on failure. Default is to destroy it. # whether to keep the prefix on failure. Default is to destroy it.
keep_prefix = kwargs.get('keep_prefix', False) keep_prefix = kwargs.get('keep_prefix', False)
keep_stage = kwargs.get('keep_stage', False) keep_stage = kwargs.get('keep_stage', False)
ignore_deps = kwargs.get('ignore_deps', False) ignore_deps = kwargs.get('ignore_deps', False)
fake_install = kwargs.get('fake', False)
if not self.spec.concrete: if not self.spec.concrete:
raise ValueError("Can only install concrete packages.") raise ValueError("Can only install concrete packages.")
@ -725,7 +726,8 @@ def do_install(self, **kwargs):
if not ignore_deps: if not ignore_deps:
self.do_install_dependencies() self.do_install_dependencies()
self.do_patch() if not fake_install:
self.do_patch()
# Fork a child process to do the build. This allows each # Fork a child process to do the build. This allows each
# package authors to have full control over their environment, # package authors to have full control over their environment,
@ -750,8 +752,14 @@ def do_install(self, **kwargs):
build_env.set_build_environment_variables(self) build_env.set_build_environment_variables(self)
build_env.set_module_variables_for_package(self) build_env.set_module_variables_for_package(self)
# Subclasses implement install() to do the real work. if fake_install:
self.install(self.spec, self.prefix) mkdirp(self.prefix.bin)
touch(join_path(self.prefix.bin, 'fake'))
mkdirp(self.prefix.lib)
mkdirp(self.prefix.man1)
else:
# Subclasses implement install() to do the real work.
self.install(self.spec, self.prefix)
# Ensure that something was actually installed. # Ensure that something was actually installed.
if not os.listdir(self.prefix): if not os.listdir(self.prefix):