Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, pythonAtLeast
6, pythonOlder
7, idna
8, multidict
9, typing-extensions
10, pytestCheckHook
11}:
12
13buildPythonPackage rec {
14 pname = "yarl";
15 version = "1.8.2";
16
17 disabled = pythonOlder "3.7";
18
19 format = "setuptools";
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-SdQ0AsbjATrQl4YCv2v1MoU1xI0ZIwS5G5ejxnkLFWI=";
24 };
25
26 patches = [
27 # https://github.com/aio-libs/yarl/issues/876
28 (fetchpatch {
29 url = "https://github.com/aio-libs/yarl/commit/0a94c6e4948e00fff072c0cf367afbf4ac36f906.patch";
30 hash = "sha256-bqT46OLZLkBef8FQ1L95ITD70mC3+WIkr3+h2ekKrvE=";
31 })
32 ];
33
34 postPatch = ''
35 sed -i '/^addopts/d' setup.cfg
36 '';
37
38 propagatedBuildInputs = [
39 idna
40 multidict
41 ] ++ lib.optionals (pythonOlder "3.8") [
42 typing-extensions
43 ];
44
45 preCheck = ''
46 # don't import yarl from ./ so the C extension is available
47 pushd tests
48 '';
49
50 nativeCheckInputs = [
51 pytestCheckHook
52 ];
53
54 disabledTests = lib.optionals (pythonAtLeast "3.11") [
55 "test_not_a_scheme2"
56 ];
57
58 postCheck = ''
59 popd
60 '';
61
62 pythonImportsCheck = [ "yarl" ];
63
64 meta = with lib; {
65 changelog = "https://github.com/aio-libs/yarl/blob/v${version}/CHANGES.rst";
66 description = "Yet another URL library";
67 homepage = "https://github.com/aio-libs/yarl";
68 license = licenses.asl20;
69 maintainers = with maintainers; [ dotlambda ];
70 };
71}