Merge pull request #310576 from drawbu/fix-duckduckgo-search

python3Package.duckduckgo-search: fix build failure
This commit is contained in:
Weijia Wang 2024-05-11 10:46:32 +02:00 committed by GitHub
commit dc0cdbd213
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,20 +1,52 @@
{ lib
, aiofiles
, buildPythonPackage
, click
, fetchFromGitHub
, h2
, httpx
, lxml
, pythonOlder
, requests
, setuptools
, socksio
}:
{
lib,
buildPythonPackage,
click,
fetchFromGitHub,
pythonOlder,
setuptools,
orjson,
curl-cffi,
# To build orjson
rustPlatform,
# Optional dependencies
lxml,
}:
let
curl-cffi_0_7_0 = curl-cffi.overrideAttrs (
final: old: {
version = "0.7.0b4";
src = fetchFromGitHub {
owner = "yifeikong";
repo = "curl_cffi";
rev = "v${final.version}";
hash = "sha256-txrJNUzswAPeH4Iazn0iKJI0Rqk0HHRoDrtTfDHKMoo=";
};
}
);
orjson_3_10_3 = orjson.overrideAttrs (
final: old: {
version = "3.10.3";
src = fetchFromGitHub {
owner = "ijl";
repo = "orjson";
rev = "refs/tags/${final.version}";
hash = "sha256-bK6wA8P/IXEbiuJAx7psd0nUUKjR1jX4scFfJr1MBAk=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit (final) src;
name = "${old.pname}-${final.version}";
hash = "sha256-ilGq+/gPSuNwURUWy2ZxInzmUv+PxYMxd8esxrMpr2o=";
};
}
);
in
buildPythonPackage rec {
pname = "duckduckgo-search";
version = "5.0";
version = "v5.3.1";
pyproject = true;
disabled = pythonOlder "3.8";
@ -22,36 +54,32 @@ buildPythonPackage rec {
src = fetchFromGitHub {
owner = "deedy5";
repo = "duckduckgo_search";
rev = "refs/tags/v${version}";
hash = "sha256-OZFkSFyXC2MFP2MbKwF/qR8zvCFzPKgLmX+nuIztOpw=";
rev = version;
hash = "sha256-T7rlB3dU7y+HbHr1Ss9KkejlXFORhnv9Va7cFTRtfQU=";
};
nativeBuildInputs = [
setuptools
];
nativeBuildInputs = [ setuptools ];
propagatedBuildInputs = [
aiofiles
click
h2
httpx
lxml
requests
socksio
] ++ httpx.optional-dependencies.brotli
++ httpx.optional-dependencies.http2
++ httpx.optional-dependencies.socks;
pythonImportsCheck = [
"duckduckgo_search"
orjson_3_10_3
curl-cffi_0_7_0
];
meta = with lib; {
passthru.optional-dependencies = {
lxml = [ lxml ];
};
doCheck = false; # tests require network access
pythonImportsCheck = [ "duckduckgo_search" ];
meta = {
description = "Python CLI and library for searching for words, documents, images, videos, news, maps and text translation using the DuckDuckGo.com search engine";
mainProgram = "ddgs";
homepage = "https://github.com/deedy5/duckduckgo_search";
changelog = "https://github.com/deedy5/duckduckgo_search/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ ];
changelog = "https://github.com/deedy5/duckduckgo_search/releases/tag/${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ drawbu ];
};
}