Commit d0fb97d9 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Julien Muchembled

- Version string is now N.N.N.devN to follow http://legacy.python.org/dev/peps/pep-0440/ .

- Support on the fly patches in zc.recipe.egg by ``EGGNAME-patches``,
  ``EGGNAME-patch-options``, ``EGGNAME-patch-binary`` (or
  ``patch-binary``) and ``EGGNAME-patch-revision`` options.
- Support on the fly patches in zc.recipe.egg:custom by ``patches``,
  ``patch-options``, ``patch-binary`` and ``patch-revision`` options.
  (options ``EGGNAME-*`` are also supported as well).
parent 7cf79d04
1.3.2.post2
-----------
- Version string is now N.N.N.devN to follow http://legacy.python.org/dev/peps/pep-0440/ .
- Support on the fly patches in zc.recipe.egg by ``EGGNAME-patches``,
``EGGNAME-patch-options``, ``EGGNAME-patch-binary`` (or
``patch-binary``) and ``EGGNAME-patch-revision`` options.
- Support on the fly patches in zc.recipe.egg:custom by ``patches``,
``patch-options``, ``patch-binary`` and ``patch-revision`` options.
(options ``EGGNAME-*`` are also supported as well).
1.3.2nxd001
-----------
- Add setup-eggs option in zc.recipe.egg:custom.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"""Setup for zc.recipe.egg package """Setup for zc.recipe.egg package
""" """
version = '1.3.2nxd001' version = '1.3.2.post2'
import os import os
from setuptools import setup, find_packages from setuptools import setup, find_packages
......
...@@ -37,6 +37,28 @@ class Base: ...@@ -37,6 +37,28 @@ class Base:
def update(self): def update(self):
return self.install() return self.install()
def _get_patch_dict(self, options, distribution):
patch_dict = {}
global_patch_binary = options.get('patch-binary', 'patch')
def get_option(egg, key, default):
return options.get('%s-%s' % (egg, key),
options.get(key, default))
egg = re.sub('[<>=].*', '', distribution)
patches = filter(lambda x:x,
map(lambda x:x.strip(),
get_option(egg, 'patches', '').splitlines()))
if not patches:
return patch_dict
patch_options = get_option(egg, 'patch-options', '-p0').split()
patch_binary = get_option(egg, 'patch-binary', global_patch_binary)
patch_revision = int(get_option(egg, 'patch-revision', len(patches)))
patch_dict[egg] = {
'patches':patches,
'patch_options':patch_options,
'patch_binary':patch_binary,
'patch_revision':patch_revision,
}
return patch_dict
class Custom(Base): class Custom(Base):
...@@ -107,11 +129,11 @@ class Custom(Base): ...@@ -107,11 +129,11 @@ class Custom(Base):
self._set_environment() self._set_environment()
try: try:
patch_dict = self._get_patch_dict(options, distribution)
return zc.buildout.easy_install.build( return zc.buildout.easy_install.build(
distribution, options['_d'], self.build_ext, distribution, options['_d'], self.build_ext,
self.links, self.index, options['executable'], [options['_e']], self.links, self.index, options['executable'], [options['_e']],
newest=self.newest, newest=self.newest, patch_dict=patch_dict)
)
finally: finally:
self._restore_environment() self._restore_environment()
......
...@@ -61,6 +61,33 @@ class Eggs(object): ...@@ -61,6 +61,33 @@ class Eggs(object):
python = options.setdefault('python', b_options['python']) python = options.setdefault('python', b_options['python'])
options['executable'] = buildout[python]['executable'] options['executable'] = buildout[python]['executable']
def _get_patch_dict(self, options, distribution_list):
patch_dict = {}
global_patch_binary = options.get('patch-binary', 'patch')
def get_option(egg, key, default):
if len(distribution_list) == 1:
return options.get('%s-%s' % (egg, key),
options.get(key, default))
else:
return options.get('%s-%s' % (egg, key), default)
for distribution in distribution_list:
egg = re.sub('[<>=].*', '', distribution)
patches = filter(lambda x:x,
map(lambda x:x.strip(),
get_option(egg, 'patches', '').splitlines()))
if not patches:
continue
patch_options = get_option(egg, 'patch-options', '-p0').split()
patch_binary = get_option(egg, 'patch-binary', global_patch_binary)
patch_revision = int(get_option(egg, 'patch-revision', len(patches)))
patch_dict[egg] = {
'patches':patches,
'patch_options':patch_options,
'patch_binary':patch_binary,
'patch_revision':patch_revision,
}
return patch_dict
def working_set(self, extra=()): def working_set(self, extra=()):
"""Separate method to just get the working set """Separate method to just get the working set
...@@ -88,6 +115,7 @@ class Eggs(object): ...@@ -88,6 +115,7 @@ class Eggs(object):
kw = {} kw = {}
if 'unzip' in options: if 'unzip' in options:
kw['always_unzip'] = options.query_bool('unzip', None) kw['always_unzip'] = options.query_bool('unzip', None)
patch_dict = self._get_patch_dict(options, distributions)
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,
...@@ -98,6 +126,7 @@ class Eggs(object): ...@@ -98,6 +126,7 @@ class Eggs(object):
include_site_packages=self.include_site_packages, include_site_packages=self.include_site_packages,
allowed_eggs_from_site_packages=self.allowed_eggs, allowed_eggs_from_site_packages=self.allowed_eggs,
allow_hosts=self.allow_hosts, allow_hosts=self.allow_hosts,
patch_dict=patch_dict,
**kw) **kw)
return orig_distributions, ws return orig_distributions, ws
......
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