[packages/python3-curl-cffi] Initial

arekm arekm at pld-linux.org
Sat Jun 6 15:45:50 CEST 2026


commit 01c41f6d3a469bcaa2b6f9543820e3bb52ca6a94
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Jun 6 15:45:20 2026 +0200

    Initial

 curl-cffi-system-libcurl.patch | 25 +++++++++++++
 python3-curl-cffi.spec         | 82 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+)
---
diff --git a/python3-curl-cffi.spec b/python3-curl-cffi.spec
new file mode 100644
index 0000000..a89d72b
--- /dev/null
+++ b/python3-curl-cffi.spec
@@ -0,0 +1,82 @@
+#
+# Conditional build:
+%bcond_with	tests	# unit tests (need litestar, proxy.py, trustme, pytest-trio
+			# and a local HTTP server - not packaged in PLD yet)
+#
+%define		module	curl_cffi
+Summary:	Python binding for curl-impersonate via cffi
+Summary(pl.UTF-8):	Wiązanie Pythona do curl-impersonate przez cffi
+Name:		python3-curl-cffi
+Version:	0.15.0
+Release:	1
+License:	MIT
+Group:		Libraries/Python
+#Source0Download: https://pypi.org/simple/curl-cffi/
+Source0:	https://files.pythonhosted.org/packages/source/c/%{module}/%{module}-%{version}.tar.gz
+# Source0-md5:	108ff8b07bacb0c292471f31025b4c7b
+Patch0:		curl-cffi-system-libcurl.patch
+URL:		https://github.com/lexiforest/curl_cffi
+BuildRequires:	curl-impersonate-devel
+BuildRequires:	python3-build
+BuildRequires:	python3-cffi >= 2.0.0
+BuildRequires:	python3-devel >= 1:3.10
+BuildRequires:	python3-installer
+BuildRequires:	python3-setuptools
+BuildRequires:	python3-wheel
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 2.044
+%if %{with tests}
+BuildRequires:	python3-pytest
+%endif
+Requires:	python3-certifi
+Requires:	python3-cffi >= 2.0.0
+Requires:	python3-rich
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+curl_cffi is a Python binding for curl-impersonate built with cffi. It
+can impersonate the TLS/JA3 and HTTP/2 fingerprints of real browsers,
+and offers a requests/httpx-like API for both synchronous and
+asynchronous use.
+
+%description -l pl.UTF-8
+curl_cffi to wiązanie Pythona do curl-impersonate zbudowane przy
+użyciu cffi. Potrafi podszywać się pod odciski TLS/JA3 oraz HTTP/2
+prawdziwych przeglądarek i udostępnia API w stylu requests/httpx do
+użytku synchronicznego oraz asynchronicznego.
+
+%prep
+%setup -q -n %{module}-%{version}
+%patch -P0 -p1
+
+%build
+export CURL_IMPERSONATE_LIBDIR="%{_libdir}"
+export CURL_IMPERSONATE_INCLUDEDIR="%{_includedir}/curl-impersonate"
+%py3_build_pyproject
+
+%if %{with tests}
+%{__python3} -m zipfile -e build-3/*.whl build-3-test
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTEST_PLUGINS= \
+%{__python3} -m pytest -o pythonpath="$PWD/build-3-test" tests/unittest
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%py3_install_pyproject
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc README.md LICENSE
+%attr(755,root,root) %{_bindir}/curl-cffi
+%dir %{py3_sitedir}/%{module}
+%{py3_sitedir}/%{module}/*.py
+%{py3_sitedir}/%{module}/py.typed
+%{py3_sitedir}/%{module}/_wrapper*.so
+%{py3_sitedir}/%{module}/__pycache__
+%{py3_sitedir}/%{module}/cli
+%{py3_sitedir}/%{module}/requests
+%{py3_sitedir}/%{module}-%{version}.dist-info
diff --git a/curl-cffi-system-libcurl.patch b/curl-cffi-system-libcurl.patch
new file mode 100644
index 0000000..c1869d1
--- /dev/null
+++ b/curl-cffi-system-libcurl.patch
@@ -0,0 +1,25 @@
+--- a/scripts/build.py
++++ b/scripts/build.py
+@@ -65,6 +65,14 @@
+ 
+ 
+ arch = detect_arch()
++
++# PLD: link against the system libcurl-impersonate shared library. The bundled
++# logic downloads a prebuilt static archive, which is impossible in the
++# network-isolated build; curl-impersonate is packaged separately.
++arch["link_type"] = "dynamic"
++arch["libdir"] = os.environ["CURL_IMPERSONATE_LIBDIR"]
++arch["obj_name"] = "libcurl-impersonate.so"
++
+ link_type = arch.get("link_type")
+ libdir = Path(arch["libdir"])
+ is_static = link_type == "static"
+@@ -178,6 +186,7 @@
+     extra_objects=[],  # linked via extra_link_args
+     source_extension=".c",
+     include_dirs=[
++        os.environ["CURL_IMPERSONATE_INCLUDEDIR"],
+         str(root_dir / "include"),
+         str(root_dir / "ffi"),
+         str(libdir / "include"),
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python3-curl-cffi.git/commitdiff/01c41f6d3a469bcaa2b6f9543820e3bb52ca6a94



More information about the pld-cvs-commit mailing list