diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2015-01-10 19:37:01 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2015-02-02 11:19:53 -0800 |
commit | bcccf020204a556e382c0af2897ad9126bb24984 (patch) | |
tree | ec2fa5aa4ad95998e5ba88b6c49eca6febf6a230 /lib | |
parent | 82946d29147bbe63855f94b9c2ebd4a21cd0a3d6 (diff) | |
download | spack-bcccf020204a556e382c0af2897ad9126bb24984.tar.gz spack-bcccf020204a556e382c0af2897ad9126bb24984.tar.bz2 spack-bcccf020204a556e382c0af2897ad9126bb24984.tar.xz spack-bcccf020204a556e382c0af2897ad9126bb24984.zip |
Add setup_extension_environment() method.
- lets packages do some setup before their extensions run install()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/package.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index da251dc4e8..8504b96fcf 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -783,6 +783,12 @@ class Package(object): self.stage.chdir_to_source() build_env.setup_package(self) + # Allow extendees to further set up the environment. + for ext_name in self.extendees: + ext_spec = self.spec[ext_name] + ext_spec.package.setup_extension_environment( + self.module, ext_spec, self.spec) + if fake_install: self.do_fake_install() else: @@ -854,6 +860,30 @@ class Package(object): fromlist=[self.__class__.__name__]) + def setup_extension_environment(self, module, spec, ext_spec): + """Called before the install() method of extensions. + + Default implementation does nothing, but this can be + overridden by an extendable package to set up the install + environment for its extensions. This is useful if there are + some common steps to installing all extensions for a + certain package. + + Some examples: + + 1. Installing python modules generally requires PYTHONPATH to + point to the lib/pythonX.Y/site-packages directory in the + module's install prefix. This could set that variable. + + 2. Extensions often need to invoke the 'python' interpreter + from the Python installation being extended. This routine can + put a 'python' Execuable object in the module scope for the + extension package to simplify extension installs. + + """ + pass + + def install(self, spec, prefix): """Package implementations override this with their own build configuration.""" raise InstallError("Package %s provides no install method!" % self.name) |