Skip to content

Commit

Permalink
Merge 2635117 into 0d94e20
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Nov 7, 2017
2 parents 0d94e20 + 2635117 commit 16d3fba
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 129 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changes
4.4.2 (unreleased)
------------------

- Nothing changed yet.
- Always install ``zope.hookable`` as a dependency (the ``hook``
extra is now empty). ``zope.hookable`` respects the PURE_PYTHON
environment variable, and has an optional C extension.


4.4.1 (2017-09-26)
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from setuptools import setup, find_packages

HOOK_REQUIRES = [
'zope.hookable',
]

PERSISTENTREGISTRY_REQUIRES = [
Expand Down Expand Up @@ -99,13 +98,14 @@ def read(*rnames):
tests_require=TESTS_REQUIRE,
install_requires=[
'setuptools',
'zope.interface>=4.1.0',
'zope.interface >= 4.1.0',
'zope.event',
'zope.hookable >= 4.2.0',
],
include_package_data=True,
zip_safe=False,
extras_require={
'hook': HOOK_REQUIRES,
'hook': HOOK_REQUIRES, # BWC
'persistentregistry': PERSISTENTREGISTRY_REQUIRES,
'security': SECURITY_REQUIRES,
'zcml': ZCML_REQUIRES,
Expand Down
9 changes: 3 additions & 6 deletions src/zope/component/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import sys
import types

from zope.hookable import hookable

from zope.interface import Interface
from zope.interface import implementedBy
from zope.interface import providedBy
Expand All @@ -30,12 +32,7 @@
from zope.component._declaration import adapter
from zope.component._declaration import adapts

# Use the C implementation in zope.hookable, if available; fall back
# to our Python version if not.
try:
from zope.hookable import hookable
except ImportError: #pragma NO COVER
from zope.component.hookable import hookable


# getSiteManager() returns a component registry. Although the term
# "site manager" is deprecated in favor of "component registry",
Expand Down
24 changes: 5 additions & 19 deletions src/zope/component/hookable.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,9 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
""" This module supplies a pure-Python version of zope.hookable.hookable.
"""
class hookable(object):
__slots__ = ('__original', '__implementation')

original = property(lambda self: self.__original,)
implementation = property(lambda self: self.__implementation,)

def __init__(self, implementation):
self.__original = self.__implementation = implementation

def sethook(self, newimplementation):
old, self.__implementation = self.__implementation, newimplementation
return old

def reset(self):
self.__implementation = self.__original

def __call__(self, *args, **kw):
return self.__implementation(*args, **kw)
This module is deprecated. Prefer to use zope.hookable.hookable.
"""
# pragma: no cover
from zope.hookable import hookable
hookable = hookable # BWC
99 changes: 0 additions & 99 deletions src/zope/component/tests/test_hookable.py

This file was deleted.

3 changes: 2 additions & 1 deletion src/zope/component/tests/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Pure-Python hookable tests
"""
Tests for zope.component.security
"""
import unittest

Expand Down

0 comments on commit 16d3fba

Please sign in to comment.