Skip to content

Commit

Permalink
Merge pull request #35 from zopefoundation/issue34
Browse files Browse the repository at this point in the history
Update the handling of PURE_PYTHON to match zope.interface and persistest
  • Loading branch information
jamadden committed Apr 1, 2020
2 parents 52279a6 + 928b911 commit 1cd4079
Show file tree
Hide file tree
Showing 13 changed files with 396 additions and 204 deletions.
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ exclude_lines =
raise NotImplementedError
self.fail
raise AssertionError

[paths]
source =
src/
.tox/*/lib/python*/site-packages/
.tox/pypy*/site-packages/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ __pycache__
*.so
.tox
.coverage
.coverage.*
htmlcov/
nosetests.xml
coverage.xml
Expand Down
15 changes: 10 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@ env:
TWINE_USERNAME: zope.wheelbuilder
TWINE_PASSWORD:
secure: "G1ORcUIV439Iws2toGhxPvYvQKQt6L1wyXfIMspz2xtjJvQ2D1XrqK8dRYyQ0YaGLY/OAI8BrEdTp/l7jrhiG0gXMeAs0k1KFbp7ATahcVT8rWOzvcLGMAiYRVloQ3rz5x5HjMm0CWpDjo1MAeJMmesyq8RlmYzaMu4aw1mBd/Y="
jobs:
# We want to require the C extensions to build and function
# everywhere (except where we specifically opt-out)
- PURE_PYTHON: 0
- PURE_PYTHON: 1

python:
- 2.7
- 3.5
- 3.6
- 3.7
- 3.8
- pypy
- pypy3

jobs:
include:
- name: "Python: 2.7, pure (no C extensions)"
python: 2.7
# Don't test C extensions on PyPy.
- python: pypy
env: PURE_PYTHON=1

- python: pypy3
env: PURE_PYTHON=1

# manylinux wheel builds
Expand Down Expand Up @@ -73,7 +79,6 @@ install:
- pip install -U pip setuptools
- pip install -U coverage coveralls
- pip install -U -e .[test]
- if [[ $PURE_PYTHON ]]; then pip install -U -e .[zodb,zcml]; fi

script:
- python --version
Expand Down
11 changes: 8 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
Changes
=========

4.3.1 (unreleased)
4.4.0 (unreleased)
==================

- Nothing changed yet.
- Support the ``PURE_PYTHON`` environment variable at runtime instead
of just at wheel build time. A value of 0 forces the C extensions to
be used failing if they aren't present. Any other value forces the
Python implementation to be used, ignoring the C extensions.

- Drop support for the deprecated ``python setup.py test`` command.


4.3.0 (2019-11-11)
Expand Down Expand Up @@ -73,7 +78,7 @@
4.1.0 (2015-05-22)
==================

- Make ``zope.container._proxy.PytContainedProxyBase`` inherit
- Make ``zope.container._proxy.PyContainedProxyBase`` inherit
directly from ``zope.proxy.AbstractProxyBase`` as well as
``persistent.Persistent``, removing a bunch of redundant code, and
fixing bugs in interaction with pure-Python persistence. See:
Expand Down
44 changes: 29 additions & 15 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
import os
import sys
import pkg_resources


sys.path.append(os.path.abspath('../src'))
rqmt = pkg_resources.require('zope.container')[0]

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand All @@ -31,6 +38,7 @@
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx.ext.extlinks',
'repoze.sphinx.autointerface',
]

Expand All @@ -55,13 +63,10 @@
# built documents.

# The full version, including alpha/beta/rc tags.
import io
with io.open('../version.txt') as f:
release = f.read().strip()

# The short X.Y version.
version = u'.'.join(release.split('.')[:2])

version = '%s.%s' % tuple(map(int, rqmt.version.split('.')[:2]))
# The full version, including alpha/beta/rc tags.
release = rqmt.version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -79,7 +84,7 @@

# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
default_role = 'obj'

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
Expand All @@ -106,7 +111,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -270,18 +275,27 @@
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'https://docs.python.org/': None,
'http://zodb.readthedocs.io/en/latest/': None,
'http://persistent.readthedocs.io/en/latest/': None,
'http://zopesize.readthedocs.io/en/latest/': None,
'http://zopesite.readthedocs.io/en/latest/': None,
'http://zopefilerepresentation.readthedocs.io/en/latest/': None,
'http://zopelifecycleevent.readthedocs.io/en/latest/': None,
'https://zodb.readthedocs.io/en/latest/': None,
'https://persistent.readthedocs.io/en/latest/': None,
'https://zopesize.readthedocs.io/en/latest/': None,
'https://zopesite.readthedocs.io/en/latest/': None,
'https://zopefilerepresentation.readthedocs.io/en/latest/': None,
'https://zopelifecycleevent.readthedocs.io/en/latest/': None,
'https://zopeinterface.readthedocs.io/en/latest/': None,
}

extlinks = {'issue': ('https://github.com/zopefoundation/zope.container/issues/%s',
'issue #'),
'pr': ('https://github.com/zopefoundation/zope.container/pull/%s',
'pull request #')}

autodoc_default_flags = ['members', 'show-inheritance']

# Sphinx 1.8+ prefers this to `autodoc_default_flags`. It's documented that
# either True or None mean the same thing as just setting the flag, but
# only None works in 1.8 (True works in 2.0)
autodoc_default_options = {
'members': None,
'show-inheritance': None,
}
autodoc_member_order = 'groupwise'
autoclass_content = 'both'
101 changes: 42 additions & 59 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"""Setup for zope.container package
"""
import os
import platform

from setuptools import setup, find_packages, Extension

Expand All @@ -29,39 +28,14 @@ def read(*rnames):
return f.read()


def alltests():
import sys
import unittest
# use the zope.testrunner machinery to find all the
# test suites we've put under ourselves
import zope.testrunner.find
import zope.testrunner.options
here = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))
args = sys.argv[:]
defaults = ["--test-path", here]
options = zope.testrunner.options.get_options(args, defaults)
suites = list(zope.testrunner.find.find_suites(options))
return unittest.TestSuite(suites)


# PyPy cannot correctly build the C optimizations, and even if it
# could they would be anti-optimizations (the C extension
# compatibility layer is known-slow, and defeats JIT opportunities).
py_impl = getattr(platform, 'python_implementation', lambda: None)
pure_python = os.environ.get('PURE_PYTHON', False)
is_pypy = py_impl() == 'PyPy'

if pure_python or is_pypy:
ext_modules = []
else:
ext_modules = [
Extension(
"zope.container._zope_container_contained",
[os.path.join("src", "zope", "container",
"_zope_container_contained.c")],
include_dirs=['include'],
),
]
ext_modules = [
Extension(
"zope.container._zope_container_contained",
[os.path.join("src", "zope", "container",
"_zope_container_contained.c")],
include_dirs=['include'],
),
]

install_requires = [
'BTrees',
Expand All @@ -85,9 +59,31 @@ def alltests():
'setuptools',
]

extras = {
'docs': [
'Sphinx',
'repoze.sphinx.autointerface',
'sphinx_rtd_theme',
],
'test': [
'zope.testing',
'zope.testrunner',
],
'zcml': [
'zope.component[zcml]',
'zope.configuration',
'zope.security[zcml]>=4.0.0a3',
],
'zodb': [
'ZODB>=3.10',
],
}

extras['test'] += (extras['zodb'] + extras['zcml'])


setup(name='zope.container',
version=read('version.txt').strip(),
version='4.4.0.dev0',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
description='Zope Container',
Expand Down Expand Up @@ -117,36 +113,23 @@ def alltests():
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope :: 3',
],
url='http://github.com/zopefoundation/zope.container',
url='https://github.com/zopefoundation/zope.container',
license='ZPL 2.1',
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['zope'],
ext_modules=ext_modules,
extras_require={
'docs': [
'Sphinx',
'repoze.sphinx.autointerface',
],
'test': [
'zope.testing',
'zope.testrunner',
],
'zcml': [
'zope.component[zcml]',
'zope.configuration',
'zope.security[zcml]>=4.0.0a3',
],
'zodb': [
'ZODB>=3.10',
],
},
extras_require=extras,
install_requires=install_requires,
tests_require=[
'zope.testing',
'zope.testrunner',
],
test_suite='__main__.alltests',
tests_require=extras['test'],
include_package_data=True,
zip_safe=False,
python_requires=', '.join([
'>=2.7',
'!=3.0.*',
'!=3.1.*',
'!=3.2.*',
'!=3.3.*',
'!=3.4.*',
]),
)
Loading

0 comments on commit 1cd4079

Please sign in to comment.