Commit 8257928e authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Xavier Thompson

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

parent 07595d60
...@@ -1458,6 +1458,7 @@ class Buildout(DictMixin): ...@@ -1458,6 +1458,7 @@ class Buildout(DictMixin):
os.write(fd, (zc.buildout.easy_install.runsetup_template % dict( os.write(fd, (zc.buildout.easy_install.runsetup_template % dict(
setupdir=os.path.dirname(setup), setupdir=os.path.dirname(setup),
setup=setup, setup=setup,
path_list=[],
__file__ = setup, __file__ = setup,
)).encode()) )).encode())
args = [sys.executable, tsetup] + args args = [sys.executable, tsetup] + args
......
...@@ -1101,9 +1101,15 @@ def develop(setup, dest, ...@@ -1101,9 +1101,15 @@ def develop(setup, dest,
undo.append(lambda: os.remove(tsetup)) undo.append(lambda: os.remove(tsetup))
undo.append(lambda: os.close(fd)) 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( os.write(fd, (runsetup_template % dict(
setupdir=directory, setupdir=directory,
setup=setup, setup=setup,
path_list=extra_path_list,
__file__ = setup, __file__ = setup,
)).encode()) )).encode())
...@@ -1554,6 +1560,10 @@ import sys ...@@ -1554,6 +1560,10 @@ import sys
sys.path.insert(0, %%(setupdir)r) sys.path.insert(0, %%(setupdir)r)
sys.path[0:0] = %r sys.path[0:0] = %r
for extra_path in %%(path_list)r:
sys.path.insert(0, extra_path)
import os, setuptools import os, setuptools
__file__ = %%(__file__)r __file__ = %%(__file__)r
...@@ -1712,7 +1722,12 @@ def call_pip_wheel(spec, dest): ...@@ -1712,7 +1722,12 @@ def call_pip_wheel(spec, dest):
env = os.environ.copy() env = os.environ.copy()
python_path = pip_path[:] 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) env['PYTHONPATH'] = os.pathsep.join(python_path)
if level <= logging.DEBUG: if level <= logging.DEBUG:
......
...@@ -83,6 +83,23 @@ class Custom(Base): ...@@ -83,6 +83,23 @@ class Custom(Base):
distribution = options.get('egg', options.get('eggs', self.name) distribution = options.get('egg', options.get('eggs', self.name)
).strip() ).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() self._set_environment()
try: try:
return zc.buildout.easy_install.build( return zc.buildout.easy_install.build(
......
...@@ -20,6 +20,10 @@ rpath ...@@ -20,6 +20,10 @@ rpath
A new-line separated list of directories to search for dynamic libraries A new-line separated list of directories to search for dynamic libraries
at run time. 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 define
A comma-separated list of names of C preprocessor variables to A comma-separated list of names of C preprocessor variables to
define. 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