diff options
author | Michael Howitz <mh@gocept.com> | 2022-07-08 09:03:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-08 09:03:28 +0200 |
commit | 5c53fd90b1a529f2d1d4ed361d3bfa646520ba58 (patch) | |
tree | b3566acd0b8d3c15a4818b64248e769ec54ba6a5 | |
parent | bd3cf813b81ded3dba9baf3f9d4fd990136471c4 (diff) | |
download | zope-proxy-5c53fd90b1a529f2d1d4ed361d3bfa646520ba58.tar.gz |
Fix PyPy2 run on GHA. (#52)
* isort lines.
-rw-r--r-- | .github/workflows/tests.yml | 24 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | .manylinux-install.sh | 8 | ||||
-rw-r--r-- | .meta.toml | 2 | ||||
-rw-r--r-- | CONTRIBUTING.md | 23 | ||||
-rw-r--r-- | MANIFEST.in | 1 | ||||
-rw-r--r-- | setup.cfg | 11 | ||||
-rw-r--r-- | setup.py | 5 | ||||
-rw-r--r-- | src/zope/proxy/__init__.py | 13 | ||||
-rw-r--r-- | src/zope/proxy/_compat.py | 1 | ||||
-rw-r--r-- | src/zope/proxy/decorator.py | 8 | ||||
-rw-r--r-- | src/zope/proxy/tests/test_decorator.py | 2 | ||||
-rw-r--r-- | src/zope/proxy/tests/test_proxy.py | 6 | ||||
-rw-r--r-- | tox.ini | 18 |
14 files changed, 94 insertions, 29 deletions
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3e42c56..8802779 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -139,11 +139,18 @@ jobs: restore-keys: | ${{ runner.os }}-pip- - - name: Install Build Dependencies + - name: Install Build Dependencies (PyPy2) + if: > + startsWith(matrix.python-version, 'pypy-2.7') + run: | + pip install -U pip + pip install -U setuptools wheel twine "cffi != 1.15.1" + - name: Install Build Dependencies (other Python versions) + if: > + !startsWith(matrix.python-version, 'pypy-2.7') run: | pip install -U pip pip install -U setuptools wheel twine cffi - pip install -U coveralls coverage - name: Build zope.proxy run: | @@ -152,7 +159,6 @@ jobs: python setup.py build_ext -i python setup.py bdist_wheel # Also install it, so that we get dependencies in the (pip) cache. - pip install -U coverage pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"' pip install .[test] @@ -169,7 +175,11 @@ jobs: # We cannot 'uses: pypa/gh-action-pypi-publish@v1.4.1' because # that's apparently a container action, and those don't run on # the Mac. - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && startsWith(runner.os, 'Mac') && !startsWith(matrix.python-version, 'pypy') + if: > + github.event_name == 'push' + && startsWith(github.ref, 'refs/tags') + && startsWith(runner.os, 'Mac') + && !startsWith(matrix.python-version, 'pypy') env: TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} run: | @@ -234,7 +244,7 @@ jobs: - name: Install zope.proxy run: | pip install -U wheel setuptools - pip install -U coverage coverage-python-version + pip install -U coverage pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"' # Unzip into src/ so that testrunner can find the .so files # when we ask it to load tests from that directory. This @@ -444,7 +454,9 @@ jobs: run: sudo chown -R $(whoami) ${{ steps.pip-cache.outputs.dir }} - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@v1.4.1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + if: > + github.event_name == 'push' + && startsWith(github.ref, 'refs/tags') with: user: __token__ password: ${{ secrets.TWINE_PASSWORD }} @@ -28,4 +28,5 @@ lib64 log/ parts/ pyvenv.cfg +testing.log var/ diff --git a/.manylinux-install.sh b/.manylinux-install.sh index c730ec9..c6bc43f 100755 --- a/.manylinux-install.sh +++ b/.manylinux-install.sh @@ -39,10 +39,10 @@ for PYBIN in /opt/python/*/bin; do "${PYBIN}/pip" install -e /io/ "${PYBIN}/pip" wheel /io/ -w wheelhouse/ if [ `uname -m` == 'aarch64' ]; then - cd /io/ - "${PYBIN}/pip" install tox - "${PYBIN}/tox" -e py - cd .. + cd /io/ + "${PYBIN}/pip" install tox + "${PYBIN}/tox" -e py + cd .. fi rm -rf /io/build /io/*.egg-info fi @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/config/c-code [meta] template = "c-code" -commit-id = "aef18fe5ee64014d8b1b9de21f1e0a0991be874e" +commit-id = "cde9741a5a0d9d04cee25cb617ee1590afebb17d" [python] with-appveyor = true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e6d84b8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,23 @@ +<!-- +Generated from: +https://github.com/zopefoundation/meta/tree/master/config/c-code +--> +# Contributing to zopefoundation projects + +The projects under the zopefoundation GitHub organization are open source and +welcome contributions in different forms: + +* bug reports +* code improvements and bug fixes +* documentation improvements +* pull request reviews + +For any changes in the repository besides trivial typo fixes you are required +to sign the contributor agreement. See +https://www.zope.dev/developer/becoming-a-committer.html for details. + +Please visit our [Developer +Guidelines](https://www.zope.dev/developer/guidelines.html) if you'd like to +contribute code changes and our [guidelines for reporting +bugs](https://www.zope.dev/developer/reporting-bugs.html) if you want to file a +bug report. diff --git a/MANIFEST.in b/MANIFEST.in index c8bc394..dfb0903 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,6 @@ # Generated from: # https://github.com/zopefoundation/meta/tree/master/config/c-code +include *.md include *.rst include *.txt include buildout.cfg @@ -19,3 +19,14 @@ ignore = docs/_build docs/_build/* docs/_build/*/* + +[isort] +force_single_line = True +combine_as_imports = True +sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER +known_third_party = six, docutils, pkg_resources +known_zope = +known_first_party = +default_section = ZOPE +line_length = 79 +lines_after_imports = 2 @@ -19,17 +19,16 @@ """Setup for zope.proxy package """ from __future__ import print_function + import os import platform - - from distutils.errors import CCompilerError from distutils.errors import DistutilsExecError from distutils.errors import DistutilsPlatformError from setuptools import Extension -from setuptools.command.build_ext import build_ext from setuptools import setup +from setuptools.command.build_ext import build_ext class optional_build_ext(build_ext): diff --git a/src/zope/proxy/__init__.py b/src/zope/proxy/__init__.py index d17187a..3fc4b53 100644 --- a/src/zope/proxy/__init__.py +++ b/src/zope/proxy/__init__.py @@ -18,8 +18,10 @@ import os import pickle from zope.interface import moduleProvides + from zope.proxy.interfaces import IProxyIntrospection + moduleProvides(IProxyIntrospection) __all__ = tuple(IProxyIntrospection) @@ -544,17 +546,16 @@ class PyNonOverridable(object): if _c_available: # pragma: no cover # Python API: not used in this module + # API for proxy-using C extensions. + from zope.proxy._zope_proxy_proxy import _CAPI # noqa: F401 unused from zope.proxy._zope_proxy_proxy import ProxyBase from zope.proxy._zope_proxy_proxy import getProxiedObject - from zope.proxy._zope_proxy_proxy import setProxiedObject from zope.proxy._zope_proxy_proxy import isProxy - from zope.proxy._zope_proxy_proxy import sameProxiedObjects - from zope.proxy._zope_proxy_proxy import queryProxy from zope.proxy._zope_proxy_proxy import queryInnerProxy + from zope.proxy._zope_proxy_proxy import queryProxy from zope.proxy._zope_proxy_proxy import removeAllProxies - - # API for proxy-using C extensions. - from zope.proxy._zope_proxy_proxy import _CAPI # noqa: F401 unused + from zope.proxy._zope_proxy_proxy import sameProxiedObjects + from zope.proxy._zope_proxy_proxy import setProxiedObject else: # no C extension available, fall back diff --git a/src/zope/proxy/_compat.py b/src/zope/proxy/_compat.py index bbd91c3..4f0b0e3 100644 --- a/src/zope/proxy/_compat.py +++ b/src/zope/proxy/_compat.py @@ -1,3 +1,4 @@ import sys + PY3 = sys.version_info[0] >= 3 diff --git a/src/zope/proxy/decorator.py b/src/zope/proxy/decorator.py index 9a53dfb..178687e 100644 --- a/src/zope/proxy/decorator.py +++ b/src/zope/proxy/decorator.py @@ -18,11 +18,13 @@ additional features. """ __docformat__ = "reStructuredText" -from zope.proxy import getProxiedObject, ProxyBase +from zope.interface import providedBy +from zope.interface.declarations import ObjectSpecification from zope.interface.declarations import ObjectSpecificationDescriptor from zope.interface.declarations import getObjectSpecification -from zope.interface.declarations import ObjectSpecification -from zope.interface import providedBy + +from zope.proxy import ProxyBase +from zope.proxy import getProxiedObject class DecoratorSpecificationDescriptor(ObjectSpecificationDescriptor): diff --git a/src/zope/proxy/tests/test_decorator.py b/src/zope/proxy/tests/test_decorator.py index a2a27ee..6d6c8f9 100644 --- a/src/zope/proxy/tests/test_decorator.py +++ b/src/zope/proxy/tests/test_decorator.py @@ -65,6 +65,7 @@ class DecoratorSpecificationDescriptorTests(unittest.TestCase): from zope.interface import Interface from zope.interface import implementer from zope.interface import provider + from zope.proxy import ProxyBase class IContextFactory(Interface): @@ -86,6 +87,7 @@ class DecoratorSpecificationDescriptorTests(unittest.TestCase): from zope.interface import Interface from zope.interface import implementer from zope.interface import provider + from zope.proxy import ProxyBase class IContextFactory(Interface): diff --git a/src/zope/proxy/tests/test_proxy.py b/src/zope/proxy/tests/test_proxy.py index 9d21d3a..973cb2c 100644 --- a/src/zope/proxy/tests/test_proxy.py +++ b/src/zope/proxy/tests/test_proxy.py @@ -15,6 +15,7 @@ """ import unittest + try: import zope.security except ImportError: # pragma: no cover @@ -30,6 +31,7 @@ class ModuleConformanceCase(unittest.TestCase): def test_module_conforms_to_IProxyIntrospection(self): from zope.interface.verify import verifyObject + import zope.proxy from zope.proxy.interfaces import IProxyIntrospection verifyObject(IProxyIntrospection, zope.proxy) @@ -1133,8 +1135,8 @@ class Test_py_sameProxiedObjects(unittest.TestCase): return PyProxyBase(obj) def _makeSecurityProxy(self, obj): - from zope.security.proxy import ProxyPy from zope.security.checker import CheckerPy + from zope.security.proxy import ProxyPy checker = CheckerPy({}) return ProxyPy(obj, checker) @@ -1231,8 +1233,8 @@ class Test_sameProxiedObjects(Test_py_sameProxiedObjects): return ProxyBase(obj) def _makeSecurityProxy(self, obj): - from zope.security.proxy import Proxy from zope.security.checker import Checker + from zope.security.proxy import Proxy checker = Checker({}) return Proxy(obj, checker) @@ -46,15 +46,25 @@ commands = [testenv:lint] basepython = python3 skip_install = true +commands = + isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py + flake8 src setup.py + check-manifest + check-python-versions deps = - flake8 check-manifest check-python-versions >= 0.19.1 wheel + flake8 + isort + +[testenv:isort-apply] +basepython = python3 +commands_pre = +deps = + isort commands = - flake8 src setup.py - check-manifest - check-python-versions + isort {toxinidir}/src {toxinidir}/setup.py [] [testenv:docs] basepython = python3 |