Skip to content

Commit e20c65d

Browse files
authored
Release 1.16.0rc2 (#13)
* move project sources to `src/` subdir (#12) * move the distutils shim module back to a plain module * MANIFEST.in, the source layout, and pytest's default sys.path behavior conspired to mask a busted package, even though we were testing against the built package. `pytest` adds cwd to the path first, and since the `cffi` is in the root (grr), even though we're testing against the installed wheel, pytest loaded the subpackage from the source, masking that it was missing from the actual package (due to flat inclusions in MANIFEST.in). This is a longer-term problem that should be addressed by moving to a standard `src/` layout, and possibly also by bringing `_cffi_backend` in as a subpackage, but there are likely many dragons there with wheels that assume the presence of the top-level package. * move project sources under src/ (cherry picked from commit 932eba2) * release 1.16.0rc2
1 parent e98d1bb commit e20c65d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+48
-39
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,51 +54,51 @@ jobs:
5454

5555
- spec: cp38-manylinux_aarch64
5656
foreign_arch: true
57-
test_args: '{project}/c'
57+
test_args: '{project}/src/c'
5858
- spec: cp39-manylinux_aarch64
5959
foreign_arch: true
60-
test_args: '{project}/c'
60+
test_args: '{project}/src/c'
6161
- spec: cp310-manylinux_aarch64
6262
foreign_arch: true
63-
test_args: '{project}/c'
63+
test_args: '{project}/src/c'
6464
- spec: cp311-manylinux_aarch64
6565
foreign_arch: true
66-
test_args: '{project}/c'
66+
test_args: '{project}/src/c'
6767
- spec: cp312-manylinux_aarch64
6868
foreign_arch: true
69-
test_args: '{project}/c'
69+
test_args: '{project}/src/c'
7070

7171
- spec: cp38-manylinux_ppc64le
7272
foreign_arch: true
73-
test_args: '{project}/c'
73+
test_args: '{project}/src/c'
7474
- spec: cp39-manylinux_ppc64le
7575
foreign_arch: true
76-
test_args: '{project}/c'
76+
test_args: '{project}/src/c'
7777
- spec: cp310-manylinux_ppc64le
7878
foreign_arch: true
79-
test_args: '{project}/c'
79+
test_args: '{project}/src/c'
8080
- spec: cp311-manylinux_ppc64le
8181
foreign_arch: true
82-
test_args: '{project}/c'
82+
test_args: '{project}/src/c'
8383
- spec: cp312-manylinux_ppc64le
8484
foreign_arch: true
85-
test_args: '{project}/c'
85+
test_args: '{project}/src/c'
8686

8787
- spec: cp38-manylinux_s390x
8888
foreign_arch: true
89-
test_args: '{project}/c'
89+
test_args: '{project}/src/c'
9090
- spec: cp39-manylinux_s390x
9191
foreign_arch: true
92-
test_args: '{project}/c'
92+
test_args: '{project}/src/c'
9393
- spec: cp310-manylinux_s390x
9494
foreign_arch: true
95-
test_args: '{project}/c'
95+
test_args: '{project}/src/c'
9696
- spec: cp311-manylinux_s390x
9797
foreign_arch: true
98-
test_args: '{project}/c'
98+
test_args: '{project}/src/c'
9999
- spec: cp312-manylinux_s390x
100100
foreign_arch: true
101-
test_args: '{project}/c'
101+
test_args: '{project}/src/c'
102102

103103
steps:
104104
- name: clone repo
@@ -261,9 +261,9 @@ jobs:
261261
CIBW_BUILD: ${{ matrix.spec }}
262262
CIBW_PRERELEASE_PYTHONS: 'True'
263263
CIBW_TEST_REQUIRES: pytest setuptools
264-
CIBW_TEST_COMMAND: 'python -m pytest {project}/c'
264+
CIBW_TEST_COMMAND: 'python -m pytest {project}/src/c'
265265
# FIXME: /testing takes ~45min on Windows and has some failures...
266-
# CIBW_TEST_COMMAND='python -m pytest {project}/c {project}/testing'
266+
# CIBW_TEST_COMMAND='python -m pytest {project}/src/c {project}/testing'
267267
run: |
268268
python -m pip install --upgrade pip
269269
pip install "${{ matrix.cibw_version || 'cibuildwheel'}}"

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
recursive-include cffi *.py *.h
2-
recursive-include c *.c *.h *.asm *.py win64.obj ffi.lib
1+
recursive-include src/cffi *.py *.h
2+
recursive-include src/c *.c *.h *.asm *.py win64.obj ffi.lib
33
recursive-include testing *.py *.c *.h
44
recursive-include doc *.py *.rst Makefile *.bat
55
recursive-include demo py.cleanup *.py embedding_test.c manual.c

doc/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
# The short X.Y version.
4848
version = '1.16'
4949
# The full version, including alpha/beta/rc tags.
50-
release = '1.16.0rc1'
50+
release = '1.16.0rc2'
5151

5252
# The language for content autogenerated by Sphinx. Refer to documentation
5353
# for a list of supported languages.

doc/source/whatsnew.rst

Lines changed: 6 additions & 0 deletions

setup.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import setuptools
88

99

10-
sources = ['c/_cffi_backend.c']
10+
sources = ['src/c/_cffi_backend.c']
1111
libraries = ['ffi']
1212
include_dirs = ['/usr/include/ffi',
1313
'/usr/include/libffi'] # may be changed by pkg-config
@@ -125,10 +125,10 @@ def use_homebrew_for_libffi():
125125

126126
if sys.platform == "win32" and uses_msvc():
127127
if platform.machine() == "ARM64":
128-
include_dirs.append(os.path.join("c/libffi_arm64/include"))
129-
library_dirs.append(os.path.join("c/libffi_arm64"))
128+
include_dirs.append(os.path.join("src/c/libffi_arm64/include"))
129+
library_dirs.append(os.path.join("src/c/libffi_arm64"))
130130
else:
131-
COMPILE_LIBFFI = 'c/libffi_x86_x64' # from the CPython distribution
131+
COMPILE_LIBFFI = 'src/c/libffi_x86_x64' # from the CPython distribution
132132
assert os.path.isdir(COMPILE_LIBFFI), "directory not found!"
133133
include_dirs[:] = [COMPILE_LIBFFI]
134134
libraries[:] = []
@@ -195,9 +195,10 @@ def has_ext_modules(self):
195195
196196
`Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_
197197
""",
198-
version='1.16.0rc1',
198+
version='1.16.0rc2',
199199
python_requires='>=3.8',
200200
packages=['cffi'] if cpython else [],
201+
package_dir={"": "src"},
201202
package_data={'cffi': ['_cffi_include.h', 'parse_c_type.h',
202203
'_embedding.h', '_cffi_errors.h']}
203204
if cpython else {},

c/_cffi_backend.c renamed to src/c/_cffi_backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <Python.h>
33
#include "structmember.h"
44

5-
#define CFFI_VERSION "1.16.0rc1"
5+
#define CFFI_VERSION "1.16.0rc2"
66

77
#ifdef MS_WIN32
88
#include <windows.h>
File renamed without changes.
File renamed without changes.
File renamed without changes.

c/cglob.c renamed to src/c/cglob.c

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

c/test_c.py renamed to src/c/test_c.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _testfunc(num):
2626
# ____________________________________________________________
2727

2828
import sys
29-
assert __version__ == "1.16.0rc1", ("This test_c.py file is for testing a version"
29+
assert __version__ == "1.16.0rc2", ("This test_c.py file is for testing a version"
3030
" of cffi that differs from the one that we"
3131
" get from 'import _cffi_backend'")
3232
if sys.version_info < (3,):
File renamed without changes.
File renamed without changes.

cffi/__init__.py renamed to src/cffi/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from .error import CDefError, FFIError, VerificationError, VerificationMissing
66
from .error import PkgConfigError
77

8-
__version__ = "1.16.0rc1"
9-
__version_info__ = (1, 16, 0, 'rc1')
8+
__version__ = "1.16.0rc2"
9+
__version_info__ = (1, 16, 0, 'rc2')
1010

1111
# The verifier module file names are based on the CRC32 of a string that
1212
# contains the following version number. It may be older than __version__
File renamed without changes.
File renamed without changes.

cffi/_embedding.h renamed to src/cffi/_embedding.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static int _cffi_initialize_python(void)
225225

226226
if (f != NULL && f != Py_None) {
227227
PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
228-
"\ncompiled with cffi version: 1.16.0rc1"
228+
"\ncompiled with cffi version: 1.16.0rc2"
229229
"\n_cffi_backend module: ", f);
230230
modules = PyImport_GetModuleDict();
231231
mod = PyDict_GetItemString(modules, "_cffi_backend");
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

testing/cffi0/test_version.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os, sys
22
import pytest
33
import cffi, _cffi_backend
4+
from pathlib import Path
45

56
def setup_module(mod):
67
if '_cffi_backend' in sys.builtin_module_names:
@@ -25,33 +26,33 @@ def test_version():
2526
assert v == _cffi_backend.__version__
2627

2728
def test_doc_version():
28-
parent = os.path.dirname(os.path.dirname(cffi.__file__))
29-
p = os.path.join(parent, 'doc', 'source', 'conf.py')
29+
cffi_root = Path(os.path.dirname(__file__)).parent.parent
30+
p = cffi_root / 'doc/source/conf.py'
3031
content = open(p).read()
3132
#
3233
v = cffi.__version__
3334
assert ("version = '%s'\n" % v[:4]) in content
3435
assert ("release = '%s'\n" % v) in content
3536

3637
def test_setup_version():
37-
parent = os.path.dirname(os.path.dirname(cffi.__file__))
38-
p = os.path.join(parent, 'setup.py')
38+
cffi_root = Path(os.path.dirname(__file__)).parent.parent
39+
p = cffi_root / 'setup.py'
3940
content = open(p).read()
4041
#
4142
v = cffi.__version__.replace('+', '')
4243
assert ("version='%s'" % v) in content
4344

4445
def test_c_version():
45-
parent = os.path.dirname(os.path.dirname(cffi.__file__))
46+
cffi_root = Path(os.path.dirname(__file__)).parent.parent
4647
v = cffi.__version__
47-
p = os.path.join(parent, 'c', 'test_c.py')
48+
p = cffi_root / 'src/c/test_c.py'
4849
content = open(p).read()
4950
#v = BACKEND_VERSIONS.get(v, v)
5051
assert (('assert __version__ == "%s"' % v) in content)
5152

5253
def test_embedding_h():
53-
parent = os.path.dirname(os.path.dirname(cffi.__file__))
54+
cffi_root = Path(os.path.dirname(__file__)).parent.parent
5455
v = cffi.__version__
55-
p = os.path.join(parent, 'cffi', '_embedding.h')
56+
p = cffi_root / 'src/cffi/_embedding.h'
5657
content = open(p).read()
5758
assert ('cffi version: %s"' % (v,)) in content

testing/cffi1/test_parse_c_type.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pytest
33
import cffi
44
from cffi import cffi_opcode
5+
from pathlib import Path
56

67
if '__pypy__' in sys.builtin_module_names:
78
try:
@@ -11,7 +12,7 @@
1112
# older pytest
1213
pytest.skip("not available on pypy")
1314

14-
cffi_dir = os.path.dirname(cffi_opcode.__file__)
15+
cffi_dir = str(Path(os.path.dirname(__file__)).parent.parent / "src/cffi")
1516

1617
r_macro = re.compile(r"#define \w+[(][^\n]*|#include [^\n]*")
1718
r_define = re.compile(r"(#define \w+) [^\n]*")

0 commit comments

Comments
 (0)