From b590c8d7572b727d565cc0b8ff660d43569845de Mon Sep 17 00:00:00 2001 From: root Date: Fri, 12 Jun 2026 19:09:37 -0500 Subject: Adding metadata --- dev-python/cffi/Manifest | 1 + dev-python/cffi/cffi-2.0.0.ebuild | 73 ++++++++++++++ .../cffi/files/cffi-1.14.0-darwin-no-brew.patch | 14 +++ .../cffi/files/cffi-2.0.0-pycparser-tests.patch | 106 +++++++++++++++++++++ dev-python/cffi/metadata.xml | 9 ++ 5 files changed, 203 insertions(+) create mode 100644 dev-python/cffi/Manifest create mode 100644 dev-python/cffi/cffi-2.0.0.ebuild create mode 100644 dev-python/cffi/files/cffi-1.14.0-darwin-no-brew.patch create mode 100644 dev-python/cffi/files/cffi-2.0.0-pycparser-tests.patch create mode 100644 dev-python/cffi/metadata.xml (limited to 'dev-python/cffi') diff --git a/dev-python/cffi/Manifest b/dev-python/cffi/Manifest new file mode 100644 index 000000000000..71dbc6b8cdfb --- /dev/null +++ b/dev-python/cffi/Manifest @@ -0,0 +1 @@ +DIST cffi-2.0.0.tar.gz 523588 BLAKE2B 2038eb1eeb89b1015ea40202cc5dc0da62989288a41cccf75baeea86051a085e28798e75ce0a74316c2f5bd94e83e0b89d3df6b97ee0f4f61dac301e239bb3e9 SHA512 a8bf705e626f6b5858cc20e9044a23fd653d155e2a2d4cb59f1eed00ef13ebd92d5a2f07738c66b361cb24d863786d4379dcd9c176250b546fbd45758e51d4f4 diff --git a/dev-python/cffi/cffi-2.0.0.ebuild b/dev-python/cffi/cffi-2.0.0.ebuild new file mode 100644 index 000000000000..e8f9164054b0 --- /dev/null +++ b/dev-python/cffi/cffi-2.0.0.ebuild @@ -0,0 +1,73 @@ +# 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 +EAPI=8 + +DISTUTILS_EXT=1 +DISTUTILS_USE_PEP517=setuptools +# DO NOT ADD pypy to PYTHON_COMPAT +# pypy bundles a modified version of cffi. Use python_gen_cond_dep instead. +PYTHON_COMPAT=( python3_{13..14} ) + +inherit distutils-r1 toolchain-funcs pypi + +DESCRIPTION="Foreign Function Interface for Python calling C code" +HOMEPAGE=" + https://cffi.readthedocs.io/ + https://pypi.org/project/cffi/ +" + +LICENSE="MIT" +SLOT="0/${PV}" +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=" + >=dev-libs/libffi-3.4.4-r1:= +" +# setuptools as a modern distutils provider +RDEPEND=" + ${DEPEND} + dev-python/pycparser[${PYTHON_USEDEP}] + dev-python/setuptools[${PYTHON_USEDEP}] +" +BDEPEND=" + ${RDEPEND} + virtual/pkgconfig + test? ( + dev-python/py[${PYTHON_USEDEP}] + ) +" + +distutils_enable_sphinx doc/source +EPYTEST_PLUGINS=() +# xdist fails to collect the tests +distutils_enable_tests pytest + +PATCHES=( + "${FILESDIR}"/cffi-1.14.0-darwin-no-brew.patch + "${FILESDIR}"/${P}-pycparser-tests.patch +) + +src_prepare() { + if [[ ${CHOST} == *darwin* ]] ; then + # Don't obsessively try to find libffi + sed -i -e "s/.*\-iwithsysroot\/usr\/include\/ffi.*/\tpass/" setup.py || die + fi + distutils-r1_src_prepare +} + +src_configure() { + tc-export PKG_CONFIG +} + +python_test() { + local EPYTEST_IGNORE=( + # these tests call pip + testing/cffi0/test_zintegration.py + ) + + "${EPYTHON}" -c "import _cffi_backend as backend" || die + epytest src/c testing +} diff --git a/dev-python/cffi/files/cffi-1.14.0-darwin-no-brew.patch b/dev-python/cffi/files/cffi-1.14.0-darwin-no-brew.patch new file mode 100644 index 000000000000..c92b6112b853 --- /dev/null +++ b/dev-python/cffi/files/cffi-1.14.0-darwin-no-brew.patch @@ -0,0 +1,14 @@ +diff --git a/setup.py b/setup.py +index e1dd39d..3e88f74 100644 +--- a/setup.py ++++ b/setup.py +@@ -105,9 +105,6 @@ def uses_msvc(): + return config.try_compile('#ifndef _MSC_VER\n#error "not MSVC"\n#endif') + + def use_pkg_config(): +- if sys.platform == 'darwin' and os.path.exists('/usr/local/bin/brew'): +- use_homebrew_for_libffi() +- + _ask_pkg_config(include_dirs, '--cflags-only-I', '-I', sysroot=True) + _ask_pkg_config(extra_compile_args, '--cflags-only-other') + _ask_pkg_config(library_dirs, '--libs-only-L', '-L', sysroot=True) diff --git a/dev-python/cffi/files/cffi-2.0.0-pycparser-tests.patch b/dev-python/cffi/files/cffi-2.0.0-pycparser-tests.patch new file mode 100644 index 000000000000..aff09198d654 --- /dev/null +++ b/dev-python/cffi/files/cffi-2.0.0-pycparser-tests.patch @@ -0,0 +1,106 @@ +https://github.com/python-cffi/cffi/commit/c36c02fa6f4f1d12a9cead81861c6f42af47da22 + +From c36c02fa6f4f1d12a9cead81861c6f42af47da22 Mon Sep 17 00:00:00 2001 +From: Eli Bendersky +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" + diff --git a/dev-python/cffi/metadata.xml b/dev-python/cffi/metadata.xml new file mode 100644 index 000000000000..acfe7097587e --- /dev/null +++ b/dev-python/cffi/metadata.xml @@ -0,0 +1,9 @@ + + + + + python@gentoo.org + Python + + baldeagleos-repo + -- cgit v1.3