import python3.11-cffi-1.15.1-1.el9

c9 imports/c9/python3.11-cffi-1.15.1-1.el9
CentOS Sources 2 years ago committed by MSVSphere Packaging Team
commit dc85e72b66

1
.gitignore vendored

@ -0,0 +1 @@
SOURCES/cffi-v1.15.1.tar.bz2

@ -0,0 +1 @@
7ced1189ef9a9c7944c2d7d0edb913fb1794eed6 SOURCES/cffi-v1.15.1.tar.bz2

@ -0,0 +1,95 @@
From 8a3c2c816d789639b49d3ae867213393ed7abdff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Fri, 15 Jul 2022 16:11:37 +0200
Subject: [PATCH] Adjust tests for a last minute Python 3.11 change in the
traceback format
See https://github.com/python/cpython/issues/93883
and https://github.com/python/cpython/pull/93994
--HG--
branch : python3.11.0b4
---
c/test_c.py | 35 ++---------------------------------
1 file changed, 2 insertions(+), 33 deletions(-)
diff --git a/c/test_c.py b/c/test_c.py
index cde83b80..048711c7 100644
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -1342,11 +1342,11 @@ def test_callback_exception():
except ImportError:
import io as cStringIO # Python 3
import linecache
- def matches(istr, ipattern, ipattern38, ipattern311):
+ def matches(istr, ipattern, ipattern38, ipattern311=None):
if sys.version_info >= (3, 8):
ipattern = ipattern38
if sys.version_info >= (3, 11):
- ipattern = ipattern311
+ ipattern = ipattern311 or ipattern38
str, pattern = istr, ipattern
while '$' in pattern:
i = pattern.index('$')
@@ -1400,16 +1400,6 @@ Traceback (most recent call last):
File "$", line $, in check_value
$
ValueError: 42
-""", """\
-Exception ignored from cffi callback <function$Zcb1 at 0x$>:
-Traceback (most recent call last):
- File "$", line $, in Zcb1
- $
- $
- File "$", line $, in check_value
- $
- $
-ValueError: 42
""")
sys.stderr = cStringIO.StringIO()
bigvalue = 20000
@@ -1424,13 +1414,6 @@ Traceback (most recent call last):
File "$", line $, in test_callback_exception
$
OverflowError: integer 60000 does not fit 'short'
-""", """\
-Exception ignored from cffi callback <function$Zcb1 at 0x$>, trying to convert the result back to C:
-Traceback (most recent call last):
- File "$", line $, in test_callback_exception
- $
- $
-OverflowError: integer 60000 does not fit 'short'
""")
sys.stderr = cStringIO.StringIO()
bigvalue = 20000
@@ -1479,19 +1462,6 @@ Traceback (most recent call last):
File "$", line $, in test_callback_exception
$
TypeError: $integer$
-""", """\
-Exception ignored from cffi callback <function$Zcb1 at 0x$>, trying to convert the result back to C:
-Traceback (most recent call last):
- File "$", line $, in test_callback_exception
- $
- $
-OverflowError: integer 60000 does not fit 'short'
-Exception ignored during handling of the above exception by 'onerror':
-Traceback (most recent call last):
- File "$", line $, in test_callback_exception
- $
- $
-TypeError: $integer$
""")
#
sys.stderr = cStringIO.StringIO()
@@ -1526,7 +1496,6 @@ Exception ignored from cffi callback <function$Zcb1 at 0x$>, trying to convert t
Traceback (most recent call last):
File "$", line $, in test_callback_exception
$
- $
OverflowError: integer 60000 does not fit 'short'
Exception ignored during handling of the above exception by 'onerror':
Traceback (most recent call last):
--
GitLab

File diff suppressed because it is too large Load Diff

@ -0,0 +1,103 @@
From 9c7d865e17ec16a847090a3e0d1498b698b99756 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Mon, 14 Nov 2022 12:30:12 +0100
Subject: [PATCH 1/2] Drop py.code usage from tests, no longer depend on the
deprecated py package
--HG--
branch : py.code
---
README.md | 2 +-
requirements.txt | 1 -
testing/cffi0/test_zintegration.py | 3 ++-
testing/cffi1/test_dlopen_unicode_literals.py | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index b4b84884..d39d88da 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ Testing/development tips
To run tests under CPython, run::
- pip install pytest py # if you don't have pytest and py already
+ pip install pytest # if you don't have pytest already
pip install pycparser
python setup.py build_ext -f -i
pytest c/ testing/
diff --git a/requirements.txt b/requirements.txt
index 881a093f..a97f0282 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,2 @@
pycparser
pytest
-py
diff --git a/testing/cffi0/test_zintegration.py b/testing/cffi0/test_zintegration.py
index d6a02ce0..ca2d4642 100644
--- a/testing/cffi0/test_zintegration.py
+++ b/testing/cffi0/test_zintegration.py
@@ -1,5 +1,6 @@
import py, os, sys, shutil
import subprocess
+import textwrap
from testing.udir import udir
import pytest
@@ -66,7 +67,7 @@ def really_run_setup_and_program(dirname, venv_dir_and_paths, python_snippet):
remove(os.path.join(basedir, '__pycache__'))
olddir = os.getcwd()
python_f = udir.join('x.py')
- python_f.write(py.code.Source(python_snippet))
+ python_f.write(textwrap.dedent(python_snippet))
try:
os.chdir(str(SNIPPET_DIR.join(dirname)))
if os.name == 'nt':
diff --git a/testing/cffi1/test_dlopen_unicode_literals.py b/testing/cffi1/test_dlopen_unicode_literals.py
index e792866e..dc955a57 100644
--- a/testing/cffi1/test_dlopen_unicode_literals.py
+++ b/testing/cffi1/test_dlopen_unicode_literals.py
@@ -1,4 +1,4 @@
-import py, os
+import os
s = """from __future__ import unicode_literals
"""
@@ -6,4 +6,4 @@ s = """from __future__ import unicode_literals
with open(os.path.join(os.path.dirname(__file__), 'test_dlopen.py')) as f:
s += f.read()
-exec(py.code.compile(s))
+exec(compile(s, filename='test_dlopen.py', mode='exec'))
--
GitLab
From 4c1551037965864cfe5494647af014e2390d077c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Mon, 14 Nov 2022 13:12:31 +0100
Subject: [PATCH 2/2] Make the space count consistent with the past
--HG--
branch : py.code
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index d39d88da..21c82b84 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ Testing/development tips
To run tests under CPython, run::
- pip install pytest # if you don't have pytest already
+ pip install pytest # if you don't have pytest already
pip install pycparser
python setup.py build_ext -f -i
pytest c/ testing/
--
GitLab

@ -0,0 +1,83 @@
%global __python3 /usr/bin/python3.11
%global python3_pkgversion 3.11
Name: python%{python3_pkgversion}-cffi
%global general_version 1.15.1
Version: %{general_version}%{?prerel:~%{prerel}}
Release: 1%{?dist}
Summary: Foreign Function Interface for Python to call C code
License: MIT
URL: https://cffi.readthedocs.org/
Source: https://foss.heptapod.net/pypy/cffi/-/archive/v%{version}/cffi-v%{version}.tar.bz2
# Adjust tests for a last minute Python 3.11 change in the traceback format
Patch0: https://foss.heptapod.net/pypy/cffi/-/merge_requests/113.patch
# Drop usage of the deprecated py.test package
Patch1: https://foss.heptapod.net/pypy/cffi/-/merge_requests/115.patch
# Drop usage of the deprecated py.code package
Patch2: https://foss.heptapod.net/pypy/cffi/-/merge_requests/116.patch
BuildRequires: make
BuildRequires: libffi-devel
BuildRequires: gcc
BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-rpm-macros
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-pycparser
Requires: python%{python3_pkgversion}-pycparser
# For tests:
BuildRequires: gcc-c++
%description
Foreign Function Interface for Python, providing a convenient and
reliable way of calling existing C code from Python. The interface is
based on LuaJITs FFI.
%prep
%autosetup -p1 -n cffi-v%{general_version}%{?prerel}
%build
%py3_build
%install
%py3_install
%check
PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m pytest c/ testing/
%files -n python%{python3_pkgversion}-cffi
%doc README.md
%license LICENSE
%{python3_sitearch}/cffi/
%{python3_sitearch}/_cffi_backend.*.so
%{python3_sitearch}/cffi-%{general_version}%{?prerel}-py%{python3_version}.egg-info/
%changelog
* Tue Nov 29 2022 Charalampos Stratakis <cstratak@redhat.com> - 1.15.1-1
- Initial package
- Fedora contributions by:
Charalampos Stratakis <cstratak@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Eric Smith <brouhaha@fedoraproject.org>
Gwyn Ciesla <limburgher@gmail.com>
Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Iryna Shcherbina <shcherbina.iryna@gmail.com>
Joel Capitao <jcapitao@redhat.com>
John Dulaney <jdulaney@fedoraproject.org>
Lumir Balhar <lbalhar@redhat.com>
Miro Hrončok <miro@hroncok.cz>
Nathaniel McCallum <nathaniel@themccallums.org>
Orion Poplawski <orion@cora.nwra.com>
Parag Nemade <pnemade@redhat.com>
Peter Robinson <pbrobinson@fedoraproject.org>
Petr Viktorin <pviktori@redhat.com>
Robert Kuska <rkuska@redhat.com>
Slavek Kabrda <bkabrda@redhat.com>
Tomáš Hrnčiar <thrnciar@redhat.com>
Tom Stellard <tstellar@redhat.com>
Troy Dawson <tdawson@redhat.com>
Loading…
Cancel
Save