Commit 04b4df66 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Xavier Thompson

[feat] Add setup-eggs option in zc.recipe.egg:custom.

parent 9fcb97b9
......@@ -1399,6 +1399,7 @@ class Buildout(DictMixin):
os.write(fd, (zc.buildout.easy_install.runsetup_template % dict(
setupdir=os.path.dirname(setup),
setup=setup,
path_list=[],
__file__ = setup,
)).encode())
args = [sys.executable, tsetup] + args
......
......@@ -1119,9 +1119,15 @@ def develop(setup, dest,
undo.append(lambda: os.remove(tsetup))
undo.append(lambda: os.close(fd))
extra_path = os.environ.get('PYTHONEXTRAPATH')
extra_path_list = []
if extra_path:
extra_path_list = extra_path.split(os.pathsep)
os.write(fd, (runsetup_template % dict(
setupdir=directory,
setup=setup,
path_list=extra_path_list,
__file__ = setup,
)).encode())
......@@ -1572,6 +1578,10 @@ import sys
sys.path.insert(0, %%(setupdir)r)
sys.path[0:0] = %r
for extra_path in %%(path_list)r:
sys.path.insert(0, extra_path)
import os, setuptools
__file__ = %%(__file__)r
......@@ -1730,7 +1740,12 @@ def call_pip_install(spec, dest):
env = os.environ.copy()
python_path = pip_path[:]
python_path.append(env.get('PYTHONPATH', ''))
env_paths = env.get('PYTHONPATH')
if env_paths:
python_path.append(env_paths)
extra_env_path = env.get('PYTHONEXTRAPATH')
if extra_env_path:
python_path.append(extra_env_path)
env['PYTHONPATH'] = os.pathsep.join(python_path)
if level <= logging.DEBUG:
......
......@@ -83,6 +83,23 @@ class Custom(Base):
distribution = options.get('egg', options.get('eggs', self.name)
).strip()
setup_eggs = [
r.strip()
for r in options.get('setup-eggs', '').split('\n')
if r.strip()]
if setup_eggs:
ws = zc.buildout.easy_install.install(
setup_eggs, options['_e'],
links=self.links,
index=self.index,
executable=sys.executable,
path=[options['_d'], options['_e']],
newest=self.newest,
)
extra_path = os.pathsep.join(ws.entries)
self.environment['PYTHONEXTRAPATH'] = os.environ['PYTHONEXTRAPATH'] = extra_path
self._set_environment()
try:
return zc.buildout.easy_install.build(
......
......@@ -20,6 +20,10 @@ rpath
A new-line separated list of directories to search for dynamic libraries
at run time.
setup-eggs
A new-line separated list of eggs that need to be installed
beforehand. It is useful to meet the `setup_requires` requirement.
define
A comma-separated list of names of C preprocessor variables to
define.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment