setup_extension_environment is now setup_dependent_environment.

- other packages, like Qt, can now use this to set up relevant build
  variables and env vars for their dependencies.

- not just extensions anymore.
This commit is contained in:
Todd Gamblin 2015-02-08 19:41:17 -08:00
parent 60a385d4a4
commit 20ec80295d
3 changed files with 15 additions and 7 deletions

View File

@ -829,10 +829,10 @@ def do_install(self, **kwargs):
self.stage.chdir_to_source() self.stage.chdir_to_source()
build_env.setup_package(self) build_env.setup_package(self)
# Allow extendees to further set up the environment. # Allow dependencies to further set up the environment.
if self.is_extension: for dep_spec in self.spec.traverse(root=False):
self.extendee_spec.package.setup_extension_environment( dep_spec.package.setup_dependent_environment(
self.module, self.extendee_spec, self.spec) self.module, dep_spec, self.spec)
if fake_install: if fake_install:
self.do_fake_install() self.do_fake_install()
@ -910,8 +910,8 @@ def module(self):
fromlist=[self.__class__.__name__]) fromlist=[self.__class__.__name__])
def setup_extension_environment(self, module, spec, ext_spec): def setup_dependent_environment(self, module, spec, dependent_spec):
"""Called before the install() method of extensions. """Called before the install() method of dependents.
Default implementation does nothing, but this can be Default implementation does nothing, but this can be
overridden by an extendable package to set up the install overridden by an extendable package to set up the install
@ -930,6 +930,8 @@ def setup_extension_environment(self, module, spec, ext_spec):
put a 'python' Execuable object in the module scope for the put a 'python' Execuable object in the module scope for the
extension package to simplify extension installs. extension package to simplify extension installs.
3. A lot of Qt extensions need QTDIR set. This can be used to do that.
""" """
pass pass

View File

@ -46,7 +46,7 @@ def site_packages_dir(self):
return os.path.join(self.python_lib_dir, 'site-packages') return os.path.join(self.python_lib_dir, 'site-packages')
def setup_extension_environment(self, module, spec, ext_spec): def setup_dependent_environment(self, module, spec, ext_spec):
"""Called before python modules' install() methods. """Called before python modules' install() methods.
In most cases, extensions will only need to have one line:: In most cases, extensions will only need to have one line::

View File

@ -1,3 +1,4 @@
import os
from spack import * from spack import *
class Qt(Package): class Qt(Package):
@ -20,6 +21,11 @@ class Qt(Package):
depends_on("libmng") depends_on("libmng")
depends_on("jpeg") depends_on("jpeg")
def setup_dependent_environment(self, module, spec, dep_spec):
"""Dependencies of Qt find it using the QTDIR environment variable."""
os.environ['QTDIR'] = self.prefix
def patch(self): def patch(self):
# Fix qmake compilers in the default mkspec # Fix qmake compilers in the default mkspec
qmake_conf = 'mkspecs/common/g++-base.conf' qmake_conf = 'mkspecs/common/g++-base.conf'