From 26717c853b2389d024bd3582454dd41cce4e8c57 Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Nov 10 2023 23:18:07 +0000 Subject: Fix building with patched cffi on Fedora 39 Signed-off-by: Nils Philippsen --- diff --git a/python-pygit2-cffiver.patch b/python-pygit2-cffiver.patch new file mode 100644 index 0000000..9cfbb43 --- /dev/null +++ b/python-pygit2-cffiver.patch @@ -0,0 +1,31 @@ +diff -up pygit2-1.13.2/docs/install.rst.cffiver pygit2-1.13.2/docs/install.rst +--- pygit2-1.13.2/docs/install.rst.cffiver 2023-10-30 09:50:04.000000000 +0100 ++++ pygit2-1.13.2/docs/install.rst 2023-11-11 00:01:15.551991748 +0100 +@@ -55,7 +55,7 @@ Supported versions of Python: + + Python requirements (these are specified in ``setup.py``): + +-- cffi 1.16.0 or later ++- cffi 1.16.0 or later (or Fedora package >= 1.15.1-5) + + Libgit2 **v1.7.1+**; binary wheels already include libgit2, so you only need to + worry about this if you install the source package. +diff -up pygit2-1.13.2/requirements.txt.cffiver pygit2-1.13.2/requirements.txt +--- pygit2-1.13.2/requirements.txt.cffiver 2023-10-30 09:50:04.000000000 +0100 ++++ pygit2-1.13.2/requirements.txt 2023-11-10 23:58:49.756179131 +0100 +@@ -1,2 +1,2 @@ +-cffi>=1.16.0 ++cffi>=1.9.1 + setuptools ; python_version >= "3.12" +diff -up pygit2-1.13.2/setup.py.cffiver pygit2-1.13.2/setup.py +--- pygit2-1.13.2/setup.py.cffiver 2023-10-30 09:50:04.000000000 +0100 ++++ pygit2-1.13.2/setup.py 2023-11-10 23:59:47.350500138 +0100 +@@ -153,7 +153,7 @@ setup( + ext_modules=ext_modules, + # Requirements + python_requires='>=3.8', +- setup_requires=['cffi>=1.16.0'], ++ setup_requires=['cffi>=1.9.1'], + install_requires=install_requires, + # URLs + url='https://github.com/libgit2/pygit2', diff --git a/python-pygit2.spec b/python-pygit2.spec index ace28ba..ec53135 100644 --- a/python-pygit2.spec +++ b/python-pygit2.spec @@ -8,6 +8,10 @@ Summary: Python bindings for libgit2 License: GPLv2 with linking exception URL: https://www.pygit2.org/ Source0: https://github.com/libgit2/pygit2/archive/v%{version}.tar.gz#/%{pkgname}-%{version}.tar.gz +# This patch lowers the Python-level dependency on cffi. Fedora package python-cffi-1.15.1-5 and +# higher contain the patches needed for Python >= 3.12. +# Remove when cffi >= 1.16.0 is available on all releases with Python 3.12. +Patch: python-pygit2-cffiver.patch BuildRequires: make BuildRequires: gcc @@ -21,10 +25,11 @@ the core of Git. %package -n python3-%{pkgname} Summary: Python 3 bindings for libgit2 %{?python_provide:%python_provide python3-%{pkgname}} -BuildRequires: python3-cffi -BuildRequires: python3-devel BuildRequires: python3-pytest -BuildRequires: python3-setuptools +# This version of cffi is patched for Python >= 3.12. +# Remove when cffi >= 1.16.0 is available on all releases with Python 3.12. +BuildRequires: python3-cffi >= 1.15.1-5 +Requires: python3-cffi >= 1.15.1-5 %description -n python3-%{pkgname} pygit2 is a set of Python bindings to the libgit2 library, which implements @@ -47,14 +52,18 @@ Documentation for %{name}. %autosetup -n %{pkgname}-%{version} -p1 +%generate_buildrequires +%pyproject_buildrequires + + %build -%py3_build +%pyproject_wheel make -C docs html %install -%py3_install +%pyproject_install find %{_builddir} -name '.buildinfo' -print -delete @@ -72,7 +81,7 @@ rm -f pygit2/__init__.py %files -n python3-%{pkgname} %license COPYING %doc README.rst -%{python3_sitearch}/%{pkgname}-*.egg-info/ +%{python3_sitearch}/%{pkgname}-*.dist-info/ %{python3_sitearch}/%{pkgname}/ %files doc