summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Rasmus Thomsen <Rasmus.thomsen@protonmail.com> 2017-09-19 16:40:24 +0200
committerAvatar Marc-Antoine Perennou <Marc-Antoine@Perennou.com> 2017-09-20 10:14:59 +0200
commitbdc67e4b8095360eb2dad30ed1635a82c28865ae (patch)
treea613b27b2f8653d7c7640db025c7a5c668e1762d
parent229600c308e15d767681c8e543baae019fb9f52d (diff)
downloadpython-bdc67e4b8095360eb2dad30ed1635a82c28865ae.tar.gz
python-bdc67e4b8095360eb2dad30ed1635a82c28865ae.tar.xz
dev-python/cffi: version bump to 1.11.0
Also attempt to fix its tests Change-Id: I5d45642a1f102bdd47750f287cdadf3b4a5750b8 Reviewed-on: https://galileo.mailstation.de/gerrit/10091 Reviewed-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
-rw-r--r--packages/dev-python/cffi/cffi-1.11.0.exheres-0 (renamed from packages/dev-python/cffi/cffi-1.10.0.exheres-0)20
-rw-r--r--packages/dev-python/cffi/files/remove-failing-python3-tests.patch58
2 files changed, 74 insertions, 4 deletions
diff --git a/packages/dev-python/cffi/cffi-1.10.0.exheres-0 b/packages/dev-python/cffi/cffi-1.11.0.exheres-0
index 86f3ed5..70abe2f 100644
--- a/packages/dev-python/cffi/cffi-1.10.0.exheres-0
+++ b/packages/dev-python/cffi/cffi-1.11.0.exheres-0
@@ -15,15 +15,12 @@ SLOT="0"
PLATFORMS="~amd64 ~x86"
MYOPTIONS=""
-# TODO: Fix !!! Exheres bug: 'cc' banned by distribution
-RESTRICT="test"
-
DEPENDENCIES="
build:
virtual/pkg-config
build+run:
dev-libs/libffi
- dev-python/pycparser[python_abis:*(-)?]
+ dev-python/pycparser[>=2.6][python_abis:*(-)?]
"
PYTEST_PARAMS=( c testing )
@@ -34,5 +31,20 @@ prepare_one_multibuild() {
edo sed \
-e "s/cc/${CC}/" \
-i testing/cffi0/test_ownlib.py
+
+ [[ $(python_get_abi) < 3 ]] || expatch -p1 \
+ "${FILES}"/remove-failing-python3-tests.patch
+}
+
+test_one_multibuild() {
+ # cffi tries to use cc, which we banned to ensure that the
+ # correct binaries are used. This should be fixed in cffi's code,
+ # but here we hack around it so that we can just run the tests
+ edo mkdir horrible-hack
+ edo ln -s /usr/$(exhost --target)/bin/${CC} "${PWD}/horrible-hack/cc"
+
+ export PATH="${PWD}/horrible-hack/:$PATH"
+
+ setup-py_test_one_multibuild
}
diff --git a/packages/dev-python/cffi/files/remove-failing-python3-tests.patch b/packages/dev-python/cffi/files/remove-failing-python3-tests.patch
new file mode 100644
index 0000000..43564de
--- /dev/null
+++ b/packages/dev-python/cffi/files/remove-failing-python3-tests.patch
@@ -0,0 +1,58 @@
+Source: Rasmus Thomsen <Rasmus.thomsen@protonmail.com>
+Upstream: No
+Reason: These tests fail with python-3, so we remove them for now
+
+diff --git a/testing/cffi0/test_verify.py b/testing/cffi0/test_verify.py
+index 280aa2a..ef6c64d 100644
+--- a/testing/cffi0/test_verify.py
++++ b/testing/cffi0/test_verify.py
+@@ -2455,22 +2455,6 @@ def test_win32_calling_convention_3():
+ pt = lib.call2(lib.cb2)
+ assert (pt.x, pt.y) == (99*500*999, -99*500*999)
+
+-def test_ffi_gc_size_arg():
+- # with PyPy's GC, these calls to ffi.gc() would rapidly consume
+- # 40 GB of RAM without the third argument
+- ffi = FFI()
+- ffi.cdef("void *malloc(size_t); void free(void *);")
+- lib = ffi.verify(r"""
+- #include <stdlib.h>
+- """)
+- for i in range(2000):
+- p = lib.malloc(20*1024*1024) # 20 MB
+- p1 = ffi.cast("char *", p)
+- for j in xrange(0, 20*1024*1024, 4096):
+- p1[j] = '!'
+- p = ffi.gc(p, lib.free, 20*1024*1024)
+- del p
+-
+ def test_ffi_gc_size_arg_2():
+ # a variant of the above: this "attack" works on cpython's cyclic gc too
+ # and I found no obvious way to prevent that. So for now, this test
+diff --git a/testing/cffi1/test_verify1.py b/testing/cffi1/test_verify1.py
+index b98771f..d8d2f06 100644
+--- a/testing/cffi1/test_verify1.py
++++ b/testing/cffi1/test_verify1.py
+@@ -2294,22 +2294,6 @@ def test_win_common_types():
+ assert ffi.typeof("UINT_PTR") is ffi.typeof(expected)
+ assert ffi.typeof("PTSTR") is ffi.typeof("wchar_t *")
+
+-def test_gc_pypy_size_arg():
+- ffi = FFI()
+- ffi.cdef("void *malloc(size_t); void free(void *);")
+- lib = ffi.verify(r"""
+- #include <stdlib.h>
+- """)
+- for i in range(2000):
+- p = lib.malloc(20*1024*1024) # 20 MB
+- p1 = ffi.cast("char *", p)
+- for j in xrange(0, 20*1024*1024, 4096):
+- p1[j] = '!'
+- p = ffi.gc(p, lib.free, 20*1024*1024)
+- del p
+- # with PyPy's GC, the above would rapidly consume 40 GB of RAM
+- # without the third argument to ffi.gc()
+-
+ def test_ffi_gc_size_arg_2():
+ # a variant of the above: this "attack" works on cpython's cyclic gc too
+ # and I found no obvious way to prevent that. So for now, this test