diff options
author | Michael Howitz <mh@gocept.com> | 2023-04-20 08:17:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-20 08:17:17 +0200 |
commit | 869deee11838b8617998969d98e65b0f868c8629 (patch) | |
tree | 50542419cd8150f8740bfeffff4443ec8120469b | |
parent | 7c9340441401198b3eae0b76517afde6ff1d1719 (diff) | |
download | zope-security-869deee11838b8617998969d98e65b0f868c8629.tar.gz |
Drop using `setup_requires`. (#98)
* Drop using ``setup_requires`` due to constant problems on GHA.
* Add preliminary support for Python 3.12a7
-rw-r--r-- | .github/workflows/tests.yml | 18 | ||||
-rw-r--r-- | .meta.toml | 3 | ||||
-rw-r--r-- | CHANGES.rst | 4 | ||||
-rw-r--r-- | MANIFEST.in | 1 | ||||
-rw-r--r-- | include/zope.proxy/zope/proxy/proxy.h | 53 | ||||
-rw-r--r-- | setup.cfg | 2 | ||||
-rw-r--r-- | setup.py | 30 |
7 files changed, 71 insertions, 40 deletions
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ff3565d..0a41e5c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -102,7 +102,7 @@ jobs: - "3.9" - "3.10" - "3.11" - - "3.12.0-alpha.5" + - "3.12.0-alpha.7" os: [ubuntu-20.04, macos-11] exclude: - os: macos-11 @@ -179,15 +179,15 @@ jobs: python setup.py build_ext -i python setup.py bdist_wheel - - name: Install zope.security and dependencies (3.12.0-alpha.5) - if: matrix.python-version == '3.12.0-alpha.5' + - name: Install zope.security and dependencies (3.12.0-alpha.7) + if: matrix.python-version == '3.12.0-alpha.7' run: | # Install to collect dependencies into the (pip) cache. # Use "--pre" here because dependencies with support for this future # Python release may only be available as pre-releases pip install --pre .[test] - name: Install zope.security and dependencies - if: matrix.python-version != '3.12.0-alpha.5' + if: matrix.python-version != '3.12.0-alpha.7' run: | # Install to collect dependencies into the (pip) cache. pip install .[test] @@ -231,7 +231,7 @@ jobs: && startsWith(github.ref, 'refs/tags') && startsWith(runner.os, 'Mac') && !startsWith(matrix.python-version, 'pypy') - && !startsWith(matrix.python-version, '3.12.0-alpha.5') + && !startsWith(matrix.python-version, '3.12.0-alpha.7') env: TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} run: | @@ -250,7 +250,7 @@ jobs: - "3.9" - "3.10" - "3.11" - - "3.12.0-alpha.5" + - "3.12.0-alpha.7" os: [ubuntu-20.04, macos-11] exclude: - os: macos-11 @@ -287,8 +287,8 @@ jobs: with: name: zope.security-${{ runner.os }}-${{ matrix.python-version }}.whl path: dist/ - - name: Install zope.security 3.12.0-alpha.5 - if: ${{ startsWith(matrix.python-version, '3.12.0-alpha.5') }} + - name: Install zope.security 3.12.0-alpha.7 + if: ${{ startsWith(matrix.python-version, '3.12.0-alpha.7') }} run: | pip install -U wheel setuptools # coverage has a wheel on PyPI for a future python version which is @@ -302,7 +302,7 @@ jobs: # Python release may only be available as pre-releases pip install --pre -U -e .[test] - name: Install zope.security - if: ${{ !startsWith(matrix.python-version, '3.12.0-alpha.5') }} + if: ${{ !startsWith(matrix.python-version, '3.12.0-alpha.7') }} run: | pip install -U wheel setuptools pip install -U coverage @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/config/c-code [meta] template = "c-code" -commit-id = "f0962ac8" +commit-id = "fe63cb4c" [python] with-appveyor = true @@ -30,6 +30,7 @@ fail-under = 99.5 additional-rules = [ "include *.sh", "recursive-include docs *.bat", + "recursive-include include *.h", "recursive-include src *.zcml", ] diff --git a/CHANGES.rst b/CHANGES.rst index 21a78f3..71f21f0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,7 +9,9 @@ PEP 3114), and drop support for the Python 2 ``next`` method name from pure-Python proxies. -- Add preliminary support for Python 3.12 as of 3.12a5. +- Add preliminary support for Python 3.12 as of 3.12a7. + +- Drop using ``setup_requires`` due to constant problems on GHA. 6.1 (2023-01-18) diff --git a/MANIFEST.in b/MANIFEST.in index 72637ed..14a3041 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -16,4 +16,5 @@ recursive-include docs Makefile recursive-include src *.py include *.sh recursive-include docs *.bat +recursive-include include *.h recursive-include src *.zcml diff --git a/include/zope.proxy/zope/proxy/proxy.h b/include/zope.proxy/zope/proxy/proxy.h new file mode 100644 index 0000000..10e5b5b --- /dev/null +++ b/include/zope.proxy/zope/proxy/proxy.h @@ -0,0 +1,53 @@ +#ifndef _proxy_H_ +#define _proxy_H_ 1 + +typedef struct { + PyObject_HEAD + PyObject *proxy_object; +} ProxyObject; + +#define Proxy_GET_OBJECT(ob) (((ProxyObject *)(ob))->proxy_object) + +typedef struct { + PyTypeObject *proxytype; + int (*check)(PyObject *obj); + PyObject *(*create)(PyObject *obj); + PyObject *(*getobject)(PyObject *proxy); +} ProxyInterface; + +#ifndef PROXY_MODULE + +/* These are only defined in the public interface, and are not + * available within the module implementation. There we use the + * classic Python/C API only. + */ + +static ProxyInterface *_proxy_api = NULL; + +static int +Proxy_Import(void) +{ + if (_proxy_api == NULL) { + PyObject *m = PyImport_ImportModule("zope.proxy"); + if (m != NULL) { + PyObject *tmp = PyObject_GetAttrString(m, "_CAPI"); + if (tmp != NULL) { + if (PyCapsule_CheckExact(tmp)) + _proxy_api = (ProxyInterface *) + PyCapsule_GetPointer(tmp, NULL); + Py_DECREF(tmp); + } + } + } + return (_proxy_api == NULL) ? -1 : 0; +} + +#define ProxyType (*_proxy_api->proxytype) +#define Proxy_Check(obj) (_proxy_api->check((obj))) +#define Proxy_CheckExact(obj) ((obj)->ob_type == ProxyType) +#define Proxy_New(obj) (_proxy_api->create((obj))) +#define Proxy_GetObject(proxy) (_proxy_api->getobject((proxy))) + +#endif /* PROXY_MODULE */ + +#endif /* _proxy_H_ */ @@ -24,7 +24,7 @@ ignore = force_single_line = True combine_as_imports = True sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER -known_third_party = six, docutils, pkg_resources, pytz +known_third_party = docutils, pkg_resources, pytz known_zope = known_first_party = default_section = ZOPE @@ -65,35 +65,12 @@ def read(*rnames): with open(os.path.join(os.path.dirname(__file__), *rnames)) as f: return f.read() -# Include directories for C extensions -# Sniff the location of the headers in the package distribution - - -class ModuleHeaderDir: - - def __init__(self, require_spec, where='../..'): - # By default, assume top-level pkg has the same name as the dist. - # Also assume that headers are located in the package dir, and - # are meant to be included as follows: - # #include "module/header_name.h" - self._require_spec = require_spec - self._where = where - - def __str__(self): - from pkg_resources import require - from pkg_resources import resource_filename - require(self._require_spec) - path = resource_filename(self._require_spec, self._where) - return os.path.abspath(path) - - -include = [ModuleHeaderDir('zope.proxy')] codeoptimization = [ Extension( "zope.security._proxy", - [os.path.join('src', 'zope', 'security', "_proxy.c")], - include_dirs=include, + include_dirs=[os.path.join('include', 'zope.proxy')], + sources=[os.path.join('src', 'zope', 'security', "_proxy.c")] ), Extension( "zope.security._zope_security_checker", @@ -111,10 +88,8 @@ is_pypy = py_impl() == 'PyPy' is_jython = 'java' in sys.platform if is_pypy or is_jython: - setup_requires = [] ext_modules = [] else: - setup_requires = ['zope.proxy >= 4.3.0'] ext_modules = codeoptimization @@ -169,7 +144,6 @@ setup(name='zope.security', packages=find_packages('src'), package_dir={'': 'src'}, namespace_packages=['zope'], - setup_requires=setup_requires, cmdclass={ 'build_ext': optional_build_ext, }, |