Merge pull request #309401 from chuangzhu/curl-cffi

python3Packages.curl-cffi: init at 0.6.3
This commit is contained in:
Lily Foster 2024-05-09 10:52:38 -04:00 committed by GitHub
commit f1010e0469
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 79 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

@ -31,6 +31,8 @@ let
pname = "curl-impersonate-${name}";
version = "0.6.1";
outputs = [ "out" "dev" ];
src = fetchFromGitHub {
owner = "lwthiker";
repo = "curl-impersonate";
@ -130,6 +132,9 @@ let
# Install zsh and fish completions
installShellCompletion $TMPDIR/curl-impersonate-${name}.{zsh,fish}
# Install headers
make -C curl-*/include install
'';
preFixup = let

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 { };