package : split environment_modifications into setup_environment and setup_dependent_environment.

package : renamed `module_modifications` to `modify_module` for consistency
This commit is contained in:
alalazo
2016-03-17 15:11:39 +01:00
parent 9cdd79e33f
commit f0f0663d1b
9 changed files with 49 additions and 60 deletions

View File

@@ -284,8 +284,8 @@ def setup_package(pkg):
# Allow dependencies to set up environment as well.
for dependency_spec in pkg.spec.traverse(root=False):
dependency_spec.package.module_modifications(pkg.module, dependency_spec, pkg.spec)
env.extend(dependency_spec.package.environment_modifications(pkg.spec))
dependency_spec.package.modify_module(pkg.module, dependency_spec, pkg.spec)
dependency_spec.package.setup_dependent_environment(env, pkg.spec)
# TODO : implement validation
#validate(env)
env.apply_modifications()

View File

@@ -162,9 +162,8 @@ def write(self):
# Environment modifications guessed by inspecting the installation prefix
env = inspect_path(self.spec.prefix)
# Package-specific environment modifications
# FIXME : decide how to distinguish between calls done in the installation and elsewhere
env.extend(self.spec.package.environment_modifications(None))
# site_specific = ...`
self.spec.package.setup_environment(env)
# TODO : implement site-specific modifications and filters
if not env:
return

View File

@@ -977,7 +977,7 @@ def module(self):
fromlist=[self.__class__.__name__])
def environment_modifications(self, dependent_spec):
def setup_environment(self, env):
"""
Called before the install() method of dependents.
@@ -998,9 +998,12 @@ def environment_modifications(self, dependent_spec):
Returns:
instance of environment modifications
"""
return EnvironmentModifications()
pass
def module_modifications(self, module, spec, dependent_spec):
def setup_dependent_environment(self, env, dependent_spec):
self.setup_environment(env)
def modify_module(self, module, spec, dependent_spec):
"""
Called before the install() method of dependents.