python3Packages.curl-cffi: init at 0.6.3

This commit is contained in:
Chuang Zhu 2024-05-06 07:39:37 +08:00
parent 6786f11afb
commit 93f99c2919
3 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,49 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, curl-impersonate-chrome
, cffi
, certifi
}:
buildPythonPackage rec {
pname = "curl-cffi";
version = "0.6.3";
src = fetchFromGitHub {
owner = "yifeikong";
repo = "curl_cffi";
rev = "v${version}";
hash = "sha256-VeBh5wp/VEMDGR2YK06w34hBv9qHIyA+EiZHrhEhAGw=";
};
patches = [
./use-system-libs.patch
];
buildInputs = [
curl-impersonate-chrome
];
format = "pyproject";
build-system = [
setuptools
];
nativeBuildInputs = [
cffi
];
propagatedBuildInputs = [
cffi
certifi
];
pythonImportsCheck = [ "curl_cffi" ];
meta = with lib; {
description = "Python binding for curl-impersonate via cffi";
homepage = "https://curl-cffi.readthedocs.io";
license = licenses.mit;
maintainers = with maintainers; [ chuangzhu ];
};
}

View file

@ -0,0 +1,23 @@
diff --git a/scripts/build.py b/scripts/build.py
index b705a0d..9bfcaab 100644
--- a/scripts/build.py
+++ b/scripts/build.py
@@ -105,7 +105,6 @@ def get_curl_libraries():
ffibuilder = FFI()
system = platform.system()
root_dir = Path(__file__).parent.parent
-download_libcurl()
ffibuilder.set_source(
@@ -114,9 +113,7 @@ ffibuilder.set_source(
#include "shim.h"
""",
# FIXME from `curl-impersonate`
- libraries=get_curl_libraries(),
- extra_objects=get_curl_archives(),
- library_dirs=[arch["libdir"]],
+ libraries=["curl-impersonate-chrome"],
source_extension=".c",
include_dirs=[
str(root_dir / "include"),

View file

@ -2636,6 +2636,8 @@ self: super: with self; {
curlify = callPackage ../development/python-modules/curlify { };
curl-cffi = callPackage ../development/python-modules/curl-cffi { };
curtsies = callPackage ../development/python-modules/curtsies { };
curve25519-donna = callPackage ../development/python-modules/curve25519-donna { };