Skip to content
Snippets Groups Projects
Commit 20ec8029 authored by Todd Gamblin's avatar Todd Gamblin
Browse files

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.
parent 60a385d4
No related branches found
No related tags found
No related merge requests found
......@@ -829,10 +829,10 @@ def do_install(self, **kwargs):
self.stage.chdir_to_source()
build_env.setup_package(self)
# Allow extendees to further set up the environment.
if self.is_extension:
self.extendee_spec.package.setup_extension_environment(
self.module, self.extendee_spec, self.spec)
# Allow dependencies to further set up the environment.
for dep_spec in self.spec.traverse(root=False):
dep_spec.package.setup_dependent_environment(
self.module, dep_spec, self.spec)
if fake_install:
self.do_fake_install()
......@@ -910,8 +910,8 @@ def module(self):
fromlist=[self.__class__.__name__])
def setup_extension_environment(self, module, spec, ext_spec):
"""Called before the install() method of extensions.
def setup_dependent_environment(self, module, spec, dependent_spec):
"""Called before the install() method of dependents.
Default implementation does nothing, but this can be
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
extension package to simplify extension installs.
3. A lot of Qt extensions need QTDIR set. This can be used to do that.
"""
pass
......
......@@ -46,7 +46,7 @@ def site_packages_dir(self):
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.
In most cases, extensions will only need to have one line::
......
import os
from spack import *
class Qt(Package):
......@@ -20,6 +21,11 @@ class Qt(Package):
depends_on("libmng")
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):
# Fix qmake compilers in the default mkspec
qmake_conf = 'mkspecs/common/g++-base.conf'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment