Refactor environment setup.

- Gave setup_environment and setup_dependent_environment more similar
  signatures. They now allows editing the Spack env and the runtime
  env for *this* package and dependents, respectively.

- modify_module renamed to setup_dependent_python_module for symmetry
  with setup_dependent_environment and to avoid confusion with
  environment modules.

- removed need for patching Package objects at runtime.

- adjust packages to reflect these changes.
This commit is contained in:
Todd Gamblin
2016-03-21 01:48:18 -07:00
parent e88df95b42
commit 439d47b4e4
9 changed files with 150 additions and 96 deletions

View File

@@ -2,7 +2,7 @@
class Ruby(Package):
"""A dynamic, open source programming language with a focus on
"""A dynamic, open source programming language with a focus on
simplicity and productivity."""
homepage = "https://www.ruby-lang.org/"
@@ -17,15 +17,17 @@ def install(self, spec, prefix):
make()
make("install")
def setup_dependent_environment(self, env, extension_spec):
def setup_dependent_environment(self, spack_env, run_env, extension_spec):
# TODO: do this only for actual extensions.
# Set GEM_PATH to include dependent gem directories
ruby_paths = []
for d in extension_spec.traverse():
if d.package.extends(self.spec):
ruby_paths.append(d.prefix)
env.set_env('GEM_PATH', concatenate_paths(ruby_paths))
spack_env.set_env('GEM_PATH', concatenate_paths(ruby_paths))
# The actual installation path for this gem
env.set_env('GEM_HOME', extension_spec.prefix)
spack_env.set_env('GEM_HOME', extension_spec.prefix)
def modify_module(self, module, spec, ext_spec):
"""Called before ruby modules' install() methods. Sets GEM_HOME
@@ -38,5 +40,3 @@ def modify_module(self, module, spec, ext_spec):
# Ruby extension builds have global ruby and gem functions
module.ruby = Executable(join_path(spec.prefix.bin, 'ruby'))
module.gem = Executable(join_path(spec.prefix.bin, 'gem'))