dev-python/cffi: Sync with Gentoo

It's from Gentoo commit 5519912ac07f338472a146ddf011647dc4fd145f.

Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
Flatcar Buildbot 2026-02-02 07:26:03 +00:00
parent a3b83ffe29
commit 332bd00982
3 changed files with 110 additions and 3 deletions

View File

@ -20,7 +20,7 @@ HOMEPAGE="
LICENSE="MIT"
SLOT="0/${PV}"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos ~x64-solaris"
# Needs recent libffi for HPPA fixes
DEPEND="

View File

@ -1,4 +1,4 @@
# Copyright 1999-2025 Gentoo Authors
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# please keep this ebuild at EAPI 8 -- sys-apps/portage dep
@ -20,7 +20,7 @@ HOMEPAGE="
LICENSE="MIT"
SLOT="0/${PV}"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos ~x64-solaris"
# Needs recent libffi for HPPA fixes
DEPEND="
@ -47,6 +47,7 @@ distutils_enable_tests pytest
PATCHES=(
"${FILESDIR}"/cffi-1.14.0-darwin-no-brew.patch
"${FILESDIR}"/${P}-pycparser-tests.patch
)
src_prepare() {

View File

@ -0,0 +1,106 @@
https://github.com/python-cffi/cffi/commit/c36c02fa6f4f1d12a9cead81861c6f42af47da22
From c36c02fa6f4f1d12a9cead81861c6f42af47da22 Mon Sep 17 00:00:00 2001
From: Eli Bendersky <eliben@gmail.com>
Date: Sat, 24 Jan 2026 17:54:58 -0800
Subject: [PATCH] Make test_parsing more resilient to changes in pycparser
(#224)
* Make test_parsing more resilient to changes in pycparser
Several tests expect precise error messages from pycparser, which pycparser
doesn't guarantee. While testing CFFI with pycparser 3.0, some tests needed
to be made more resilient. I've used the .startswith() approach already used
in this file, instead of exact string matching.
Ref #223
* Loosen error message assertion even more
---
testing/cffi0/test_parsing.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py
index 8d4dd016..3e47bcdd 100644
--- a/testing/cffi0/test_parsing.py
+++ b/testing/cffi0/test_parsing.py
@@ -197,7 +197,7 @@ def test_dont_remove_comment_in_line_directives():
some syntax error here
""")
- assert str(e.value) == "parse error\nbaz.c:9:14: before: syntax"
+ assert str(e.value).startswith("parse error\nbaz.c:9:")
#
e = pytest.raises(CDefError, ffi.cdef, """
#line 7 "foo//bar.c"
@@ -205,21 +205,21 @@ def test_dont_remove_comment_in_line_directives():
some syntax error here
""")
#
- assert str(e.value) == "parse error\nfoo//bar.c:8:14: before: syntax"
+ assert str(e.value).startswith("parse error\nfoo//bar.c:8:")
ffi = FFI(backend=FakeBackend())
e = pytest.raises(CDefError, ffi.cdef, """
\t # \t 8 \t "baz.c" \t
some syntax error here
""")
- assert str(e.value) == "parse error\nbaz.c:9:14: before: syntax"
+ assert str(e.value).startswith("parse error\nbaz.c:9:")
#
e = pytest.raises(CDefError, ffi.cdef, """
# 7 "foo//bar.c"
some syntax error here
""")
- assert str(e.value) == "parse error\nfoo//bar.c:8:14: before: syntax"
+ assert str(e.value).startswith("parse error\nfoo//bar.c:8:")
def test_multiple_line_directives():
ffi = FFI(backend=FakeBackend())
@@ -233,7 +233,7 @@ def test_multiple_line_directives():
#line 8 "yadda.c"
extern int zz;
""")
- assert str(e.value) == "parse error\nbaz.c:7:14: before: syntax"
+ assert str(e.value).startswith("parse error\nbaz.c:7:")
#
e = pytest.raises(CDefError, ffi.cdef,
""" # 5 "foo.c"
@@ -245,7 +245,7 @@ def test_multiple_line_directives():
# 8 "yadda.c"
extern int zz;
""")
- assert str(e.value) == "parse error\nbaz.c:7:14: before: syntax"
+ assert str(e.value).startswith("parse error\nbaz.c:7:")
def test_commented_line_directive():
ffi = FFI(backend=FakeBackend())
@@ -262,7 +262,7 @@ def test_commented_line_directive():
some syntax error
""")
#
- assert str(e.value) == "parse error\nbar.c:9:14: before: syntax"
+ assert str(e.value).startswith("parse error\nbar.c:9:")
e = pytest.raises(CDefError, ffi.cdef, """
/*
# 5 "foo.c"
@@ -275,7 +275,7 @@ def test_commented_line_directive():
*/
some syntax error
""")
- assert str(e.value) == "parse error\nbar.c:9:14: before: syntax"
+ assert str(e.value).startswith("parse error\nbar.c:9:")
def test_line_continuation_in_defines():
ffi = FFI(backend=FakeBackend())
@@ -365,7 +365,7 @@ def test_unknown_name():
e = pytest.raises(CDefError, ffi.cast, "foobarbazunknown*", 0)
assert str(e.value).startswith('cannot parse "foobarbazunknown*"')
e = pytest.raises(CDefError, ffi.cast, "int(*)(foobarbazunknown)", 0)
- assert str(e.value).startswith('cannot parse "int(*)(foobarbazunknown)"')
+ assert 'foobarbazunknown' in str(e.value)
def test_redefine_common_type():
prefix = "" if sys.version_info < (3,) else "b"