package : renamed setup_dependent_environment
to module_modifications
This commit is contained in:
parent
c85888eb57
commit
572cb93bf8
@ -284,8 +284,8 @@ def setup_package(pkg):
|
|||||||
|
|
||||||
# Allow dependencies to set up environment as well.
|
# Allow dependencies to set up environment as well.
|
||||||
for dep_spec in pkg.spec.traverse(root=False):
|
for dep_spec in pkg.spec.traverse(root=False):
|
||||||
env.extend(dep_spec.package.environment_modifications(pkg.module, dep_spec, pkg.spec))
|
dep_spec.package.module_modifications(pkg.module, dep_spec, pkg.spec)
|
||||||
dep_spec.package.setup_dependent_environment(pkg.module, dep_spec, pkg.spec)
|
env.extend(dep_spec.package.environment_modifications(pkg.spec))
|
||||||
apply_environment_modifications(env)
|
apply_environment_modifications(env)
|
||||||
|
|
||||||
|
|
||||||
|
@ -984,10 +984,10 @@ def module(self):
|
|||||||
fromlist=[self.__class__.__name__])
|
fromlist=[self.__class__.__name__])
|
||||||
|
|
||||||
|
|
||||||
def environment_modifications(self, module, spec, dependent_spec):
|
def environment_modifications(self, dependent_spec):
|
||||||
return EnvironmentModifications()
|
return EnvironmentModifications()
|
||||||
|
|
||||||
def setup_dependent_environment(self, module, spec, dependent_spec):
|
def module_modifications(self, module, spec, dependent_spec):
|
||||||
"""Called before the install() method of dependents.
|
"""Called before the install() method of dependents.
|
||||||
|
|
||||||
Default implementation does nothing, but this can be
|
Default implementation does nothing, but this can be
|
||||||
|
@ -46,8 +46,8 @@ class Mpich(Package):
|
|||||||
provides('mpi@:3.0', when='@3:')
|
provides('mpi@:3.0', when='@3:')
|
||||||
provides('mpi@:1.3', when='@1:')
|
provides('mpi@:1.3', when='@1:')
|
||||||
|
|
||||||
def environment_modifications(self, module, spec, dependent_spec):
|
def environment_modifications(self, dependent_spec):
|
||||||
env = super(Mpich, self).environment_modifications(module, spec, dependent_spec)
|
env = super(Mpich, self).environment_modifications(dependent_spec)
|
||||||
env.set_env('MPICH_CC', os.environ['CC'])
|
env.set_env('MPICH_CC', os.environ['CC'])
|
||||||
env.set_env('MPICH_CXX', os.environ['CXX'])
|
env.set_env('MPICH_CXX', os.environ['CXX'])
|
||||||
env.set_env('MPICH_F77', os.environ['F77'])
|
env.set_env('MPICH_F77', os.environ['F77'])
|
||||||
@ -55,7 +55,7 @@ def environment_modifications(self, module, spec, dependent_spec):
|
|||||||
env.set_env('MPICH_FC', os.environ['FC'])
|
env.set_env('MPICH_FC', os.environ['FC'])
|
||||||
return env
|
return env
|
||||||
|
|
||||||
def setup_dependent_environment(self, module, spec, dep_spec):
|
def module_modifications(self, module, spec, dep_spec):
|
||||||
"""For dependencies, make mpicc's use spack wrapper."""
|
"""For dependencies, make mpicc's use spack wrapper."""
|
||||||
# FIXME : is this necessary ? Shouldn't this be part of a contract with MPI providers?
|
# FIXME : is this necessary ? Shouldn't this be part of a contract with MPI providers?
|
||||||
module.mpicc = join_path(self.prefix.bin, 'mpicc')
|
module.mpicc = join_path(self.prefix.bin, 'mpicc')
|
||||||
|
@ -40,7 +40,7 @@ def install(self, spec, prefix):
|
|||||||
make()
|
make()
|
||||||
make("install")
|
make("install")
|
||||||
|
|
||||||
def setup_dependent_environment(self, module, spec, dependent_spec):
|
def module_modifications(self, module, spec, dependent_spec):
|
||||||
# TODO treat OS that are not Linux...
|
# TODO treat OS that are not Linux...
|
||||||
lib_suffix = '.so' if '+shared' in spec['scalapack'] else '.a'
|
lib_suffix = '.so' if '+shared' in spec['scalapack'] else '.a'
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@ class Openmpi(Package):
|
|||||||
def url_for_version(self, version):
|
def url_for_version(self, version):
|
||||||
return "http://www.open-mpi.org/software/ompi/v%s/downloads/openmpi-%s.tar.bz2" % (version.up_to(2), version)
|
return "http://www.open-mpi.org/software/ompi/v%s/downloads/openmpi-%s.tar.bz2" % (version.up_to(2), version)
|
||||||
|
|
||||||
def environment_modifications(self, module, spec, dependent_spec):
|
def environment_modifications(self, dependent_spec):
|
||||||
env = super(Openmpi, self).environment_modifications(module, spec, dependent_spec)
|
env = super(Openmpi, self).environment_modifications(dependent_spec)
|
||||||
# FIXME : the compilers should point to the current wrappers, not to generic cc etc.
|
# FIXME : the compilers should point to the current wrappers, not to generic cc etc.
|
||||||
env.set_env('OMPI_CC', 'cc')
|
env.set_env('OMPI_CC', 'cc')
|
||||||
env.set_env('OMPI_CXX', 'c++')
|
env.set_env('OMPI_CXX', 'c++')
|
||||||
|
@ -89,19 +89,17 @@ def python_include_dir(self):
|
|||||||
def site_packages_dir(self):
|
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 environment_modifications(self, extension_spec):
|
||||||
def environment_modifications(self, module, spec, dependent_spec):
|
env = super(Python, self).environment_modifications(extension_spec)
|
||||||
env = super(Python, self).environment_modifications(module, spec, dependent_spec)
|
|
||||||
# Set PYTHONPATH to include site-packages dir for the
|
# Set PYTHONPATH to include site-packages dir for the
|
||||||
# extension and any other python extensions it depends on.
|
# extension and any other python extensions it depends on.
|
||||||
python_paths = []
|
python_paths = []
|
||||||
for d in ext_spec.traverse():
|
for d in extension_spec.traverse():
|
||||||
if d.package.extends(self.spec):
|
if d.package.extends(self.spec):
|
||||||
python_paths.append(os.path.join(d.prefix, self.site_packages_dir))
|
python_paths.append(os.path.join(d.prefix, self.site_packages_dir))
|
||||||
env.set_env['PYTHONPATH'] = ':'.join(python_paths)
|
env.set_env['PYTHONPATH'] = ':'.join(python_paths)
|
||||||
|
|
||||||
|
def module_modifications(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::
|
||||||
|
@ -52,11 +52,8 @@ class Qt(Package):
|
|||||||
depends_on("mesa", when='@4:+mesa')
|
depends_on("mesa", when='@4:+mesa')
|
||||||
depends_on("libxcb")
|
depends_on("libxcb")
|
||||||
|
|
||||||
def environment_modifications(self, module, spec, dep_spec):
|
def environment_modifications(self, dependent_spec):
|
||||||
"""
|
env = super(Qt, self).environment_modifications(dependent_spec)
|
||||||
Dependencies of Qt find it using the QTDIR environment variable
|
|
||||||
"""
|
|
||||||
env = super(Qt, self).environment_modifications(module, spec, dep_spec)
|
|
||||||
env.set_env['QTDIR'] = self.prefix
|
env.set_env['QTDIR'] = self.prefix
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from spack import *
|
from spack import *
|
||||||
import spack
|
|
||||||
import os
|
|
||||||
|
|
||||||
class Ruby(Package):
|
class Ruby(Package):
|
||||||
"""A dynamic, open source programming language with a focus on
|
"""A dynamic, open source programming language with a focus on
|
||||||
@ -18,19 +17,19 @@ def install(self, spec, prefix):
|
|||||||
make()
|
make()
|
||||||
make("install")
|
make("install")
|
||||||
|
|
||||||
def environment_modifications(self, module, spec, ext_spec):
|
def environment_modifications(self, extension_spec):
|
||||||
env = super(Ruby, self).environment_modifications(module, spec, ext_spec)
|
env = super(Ruby, self).environment_modifications(extension_spec)
|
||||||
# Set GEM_PATH to include dependent gem directories
|
# Set GEM_PATH to include dependent gem directories
|
||||||
ruby_paths = []
|
ruby_paths = []
|
||||||
for d in ext_spec.traverse():
|
for d in extension_spec.traverse():
|
||||||
if d.package.extends(self.spec):
|
if d.package.extends(self.spec):
|
||||||
ruby_paths.append(d.prefix)
|
ruby_paths.append(d.prefix)
|
||||||
env.set_env('GEM_PATH', concatenate_paths(ruby_paths))
|
env.set_env('GEM_PATH', concatenate_paths(ruby_paths))
|
||||||
# The actual installation path for this gem
|
# The actual installation path for this gem
|
||||||
env.set_env('GEM_HOME', ext_spec.prefix)
|
env.set_env('GEM_HOME', extension_spec.prefix)
|
||||||
return env
|
return env
|
||||||
|
|
||||||
def setup_dependent_environment(self, module, spec, ext_spec):
|
def module_modifications(self, module, spec, ext_spec):
|
||||||
"""Called before ruby modules' install() methods. Sets GEM_HOME
|
"""Called before ruby modules' install() methods. Sets GEM_HOME
|
||||||
and GEM_PATH to values appropriate for the package being built.
|
and GEM_PATH to values appropriate for the package being built.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user