Skip to content

Commit

Permalink
Merge pull request #20 from zopefoundation/py37
Browse files Browse the repository at this point in the history
python3.7 builds for linux, mac, and windows
  • Loading branch information
jamadden committed Oct 5, 2018
2 parents 3e6f7bb + 8b6cadb commit 92cb077
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .manylinux-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ for PYBIN in /opt/python/*/bin; do
[[ "${PYBIN}" == *"cp33"* ]] || \
[[ "${PYBIN}" == *"cp34"* ]] || \
[[ "${PYBIN}" == *"cp35"* ]] || \
[[ "${PYBIN}" == *"cp36"* ]]; then
[[ "${PYBIN}" == *"cp36"* ]] || \
[[ "${PYBIN}" == *"cp37"* ]]; then
"${PYBIN}/pip" install -e /io/
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
rm -rf /io/build /io/*.egg-info
Expand Down
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ matrix:
python: 3.5
- os: linux
python: 3.6
- os: linux
python: 3.7
dist: xenial
sudo: true
- os: linux
python: pypy
- os: linux
Expand All @@ -29,6 +33,9 @@ matrix:
- os: osx
language: generic
env: TERRYFY_PYTHON='macpython 3.6.1'
- os: osx
language: generic
env: TERRYFY_PYTHON='macpython 3.7.0'
- services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

- Drop support for Python 3.3.

- Add support for Python 3.7. ``SortingIndexMixin.sort`` now just
returns instead of raising ``StopIteration`` as required by
:pep:`479`. See `issue 20 <https://github.com/zopefoundation/zope.index/pull/20>`_.

- Docs are now hosted at https://zopeindex.readthedocs.io/

- Drop support for ``setup.py test``.
Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ environment:
- python: 35-x64
- python: 36
- python: 36-x64
- python: 37
- python: 37-x64

install:
- "SET PATH=C:\\Python%PYTHON%;c:\\Python%PYTHON%\\scripts;%PATH%"
Expand Down
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ def read(*rnames):
with open(os.path.join(os.path.dirname(__file__), *rnames)) as f:
return f.read()

long_description = (open('README.rst').read() +
'\n\n' +
open('CHANGES.rst').read())
long_description = (
read('README.rst')
+ '\n\n'
+ read('CHANGES.rst')
)

class optional_build_ext(build_ext):
"""This class subclasses build_ext and allows
Expand Down Expand Up @@ -85,6 +87,7 @@ def _unavailable(self, e):
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
Expand Down
10 changes: 5 additions & 5 deletions src/zope/index/field/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ def sort(self, docids, reverse=False, limit=None):

numdocs = getattr(self, self._sorting_num_docs_attr).value
if not numdocs:
raise StopIteration
return

if not isinstance(docids,
(self.family.IF.Set, self.family.IF.TreeSet)):
docids = self.family.IF.Set(docids)
if not docids:
raise StopIteration
return

rlen = len(docids)

Expand Down Expand Up @@ -88,7 +88,7 @@ def nsort():
it = iter(iterable)
result = sorted(islice(it, 0, limit))
if not result:
raise StopIteration
return
insort = bisect.insort
pop = result.pop
los = result[-1] # los --> Largest of the nsmallest
Expand Down Expand Up @@ -118,7 +118,7 @@ def nsort():
n += 1
yield docid
if limit and n >= limit:
raise StopIteration
return
else:
# If the result set is not much larger than the number
# of documents in this index, or if we need to sort in
Expand All @@ -129,4 +129,4 @@ def nsort():
n += 1
yield docid
if limit and n >= limit:
raise StopIteration
return
4 changes: 2 additions & 2 deletions src/zope/index/field/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ def test_insert_none_value_to_update_does_not_raise_typeerror(self):
def test_insert_none_value_does_insert_into_forward_index(self):
index = self._makeOne()
index.index_doc(1, None)
self.assertEquals(len(index._fwd_index), 1)
self.assertEquals(len(index._rev_index), 1)
self.assertEqual(len(index._fwd_index), 1)
self.assertEqual(len(index._rev_index), 1)

def test_suite():
return unittest.TestSuite((
Expand Down
5 changes: 4 additions & 1 deletion src/zope/index/text/ricecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def __init__(self, buf=None):
self.bitsleft = 0

def tostring(self):
return self.bytes.tostring()
# tostring is deprecated on Python 3, but tobytes isn't available
# on Python 2
tobytes = getattr(self.bytes, 'tobytes', None) or self.bytes.tostring
return tobytes()

def __getitem__(self, i):
byte, offset = divmod(i, 8)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py27,py34,py35,py36,pypy,pypy3,coverage,docs
py27,py34,py35,py36,py37,pypy,pypy3,coverage,docs

[testenv]
commands =
Expand Down

0 comments on commit 92cb077

Please sign in to comment.