Commit ca6a2f94 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

zc.recipe.egg: Improve on the fly pathces.

Now specified patches are automatically applied on required eggs as well.
parent 53fc6369
...@@ -860,6 +860,8 @@ class Installer: ...@@ -860,6 +860,8 @@ class Installer:
else: else:
logger.debug('Adding required %r', str(req)) logger.debug('Adding required %r', str(req))
_log_requirement(ws, req) _log_requirement(ws, req)
self._env.scan(
self.build(str(req), {}, patch_dict=patch_dict))
for dist in self._get_dist(req, ws, for dist in self._get_dist(req, ws,
for_buildout_run=for_buildout_run): for_buildout_run=for_buildout_run):
ws.add(dist) ws.add(dist)
......
...@@ -51,17 +51,21 @@ class Eggs(object): ...@@ -51,17 +51,21 @@ class Eggs(object):
options['develop-eggs-directory'] = b_options['develop-eggs-directory'] options['develop-eggs-directory'] = b_options['develop-eggs-directory']
options['_d'] = options['develop-eggs-directory'] # backward compat. options['_d'] = options['develop-eggs-directory'] # backward compat.
def _get_patch_dict(self, options, distribution_list): def _get_patch_dict(self, options, egg=None):
patch_dict = {} patch_dict = {}
global_patch_binary = options.get('patch-binary', 'patch') global_patch_binary = options.get('patch-binary', 'patch')
if egg:
egg = re.sub('[<>=].*', '', egg)
egg_list = [egg]
else:
egg_list = [x[:-8] for x in options.keys() if x.endswith('-patches')]
def get_option(egg, key, default): def get_option(egg, key, default):
if len(distribution_list) == 1: if len(egg_list) == 1:
return options.get('%s-%s' % (egg, key), return options.get('%s-%s' % (egg, key),
options.get(key, default)) options.get(key, default))
else: else:
return options.get('%s-%s' % (egg, key), default) return options.get('%s-%s' % (egg, key), default)
for distribution in distribution_list: for egg in egg_list:
egg = re.sub('[<>=].*', '', distribution)
patches = filter(lambda x:x, patches = filter(lambda x:x,
map(lambda x:x.strip(), map(lambda x:x.strip(),
get_option(egg, 'patches', '').splitlines())) get_option(egg, 'patches', '').splitlines()))
...@@ -103,7 +107,7 @@ class Eggs(object): ...@@ -103,7 +107,7 @@ class Eggs(object):
[options['develop-eggs-directory'], options['eggs-directory']] [options['develop-eggs-directory'], options['eggs-directory']]
) )
else: else:
patch_dict = self._get_patch_dict(options, distributions) patch_dict = self._get_patch_dict(options)
ws = zc.buildout.easy_install.install( ws = zc.buildout.easy_install.install(
distributions, options['eggs-directory'], distributions, options['eggs-directory'],
links=self.links, links=self.links,
......
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