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

@@ -89,24 +89,21 @@ def python_include_dir(self):
def site_packages_dir(self):
return os.path.join(self.python_lib_dir, 'site-packages')
def environment_modifications(self, extension_spec):
env = super(Python, self).environment_modifications(extension_spec)
if extension_spec is not None:
# Set PYTHONPATH to include site-packages dir for the
# extension and any other python extensions it depends on.
python_paths = []
for d in extension_spec.traverse():
if d.package.extends(self.spec):
python_paths.append(os.path.join(d.prefix, self.site_packages_dir))
env.set_env['PYTHONPATH'] = ':'.join(python_paths)
return env
def setup_dependent_environment(self, env, extension_spec):
# Set PYTHONPATH to include site-packages dir for the extension and any other python extensions it depends on.
python_paths = []
for d in extension_spec.traverse():
if d.package.extends(self.spec):
python_paths.append(os.path.join(d.prefix, self.site_packages_dir))
env.set_env['PYTHONPATH'] = ':'.join(python_paths)
def module_modifications(self, module, spec, ext_spec):
"""Called before python modules' install() methods.
def modify_module(self, module, spec, ext_spec):
"""
Called before python modules' install() methods.
In most cases, extensions will only need to have one line::
python('setup.py', 'install', '--prefix=%s' % prefix)
python('setup.py', 'install', '--prefix=%s' % prefix)
"""
# Python extension builds can have a global python executable function
if self.version >= Version("3.0.0") and self.version < Version("4.0.0"):