Skip to content

Commit

Permalink
Add support for Python 3.6
Browse files Browse the repository at this point in the history
Only pass re.LOCALE under Python 2.

Fixes #8
  • Loading branch information
jamadden committed Apr 21, 2017
1 parent dbb89ba commit dabaac5
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 35 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ matrix:
python: 3.4
- os: linux
python: 3.5
- os: linux
python: 3.6
- os: linux
python: pypy
- os: linux
Expand All @@ -23,15 +25,18 @@ matrix:
- os: osx
language: generic
env: TERRYFY_PYTHON='macpython 3.5'
- os: osx
language: generic
env: TERRYFY_PYTHON='macpython 3.6.1'
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git clone https://github.com/MacPython/terryfy; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source terryfy/travis_tools.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then get_python_environment $TERRYFY_PYTHON venv; fi
- pip install --upgrade pip
install:
- pip install -e .
- pip install -e .[test]
script:
- python setup.py -q test -q
- zope-testrunner --test-path=src
notifications:
email: false
after_success:
Expand Down
16 changes: 11 additions & 5 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ Changes
4.2.1 (unreleased)
------------------

- None are now valid values in a field index. This requires BTrees >= 4.4.1
- ``None`` are now valid values in a field index. This requires BTrees
>= 4.4.1.
- Allow ``TypeError`` to propagate from a field index when the value
cannot be stored in a BTree. Previously it was silently ignored
because it was expected that these were usually ``None``.
- Add support for Python 3.6. See `issue 8
<https://github.com/zopefoundation/zope.index/issues/8>`_.

4.2.0 (2016-06-10)
------------------
Expand Down Expand Up @@ -132,21 +138,21 @@ Changes
This makes it more compatible with other indexes (for example, when
using in catalog). This change can lead to problems, if your code somehow
depends on the II nature of sets, as it was before.

Also, FilteredSets used to use IFSets as well, if you have any
FilteredSets pickled in the database, you need to migrate them to
IFSets yourself. You can do it like that:

filter._ids = filter.family.IF.Set(filter._ids)

Where ``filter`` is an instance of FilteredSet.

- IMPORTANT: KeywordIndex are now non-normalizing. Because
it can be useful for non-string keywords, where case-normalizing
doesn't make any sense. Instead, it provides the ``normalize``
method that can be overriden by subclasses to provide some
normalization.

The CaseInsensitiveKeywordIndex class is now provided that
do case-normalization for string-based keywords. The old
CaseSensitiveKeywordIndex is gone, applications should use
Expand Down
48 changes: 28 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,35 +90,43 @@ def alltests():
description="Indices for using with catalog like text, field, etc.",
long_description=long_description,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Software Development',
],
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Software Development',
],
packages=find_packages('src'),
package_dir = {'': 'src'},
namespace_packages=['zope',],
extras_require={
'test': [],
'tools': ['ZODB', 'transaction']},
'test': [
'zope.testrunner',
],
'tools': [
'ZODB',
'transaction'
]
},
install_requires=[
'persistent',
'BTrees>=4.4.1',
'setuptools',
'six',
'zope.interface'],
'zope.interface'
],
tests_require = ['zope.testrunner'],
test_suite = '__main__.alltests',
ext_modules=[
Expand Down
14 changes: 12 additions & 2 deletions src/zope/index/text/htmlsplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@
from zope.index.text.interfaces import ISplitter

MARKUP = re.compile(r"(<[^<>]*>|&[A-Za-z]+;)")
WORDS = re.compile(r"(?L)\w+")
GLOBS = re.compile(r"(?L)\w+[\w*?]*")

_flags = 0
if bytes is str:
# On python 2, we want locale aware splitting. This is the default
# on Python 3 when the pattern is text/unicode and in fact is
# forbidden unless the pattern is bytes (starting) in 3.6
_flags = re.LOCALE

WORDS = re.compile(r"\w+", _flags)
GLOBS = re.compile(r"\w+[\w*?]*", _flags)

del _flags

@implementer(ISplitter)
class HTMLWordSplitter(object):
Expand Down
9 changes: 3 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
[tox]
envlist =
py27,py33,py34,py35,pypy,pypy3
py27,py33,py34,py35,py36,pypy,pypy3

[testenv]
commands =
python setup.py -q test -q
zope-testrunner --test-path=src
deps =
BTrees
persistent
zope.interface
zope.testrunner
.[test]

0 comments on commit dabaac5

Please sign in to comment.