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.9.2";
16
17 disabled = pythonOlder "3.7";
18
19 format = "setuptools";
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-BKudS59YfAbYAcKr/pMXt3zfmWxlqQ1ehOzEUBCCNXE=";
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 postCheck = ''
55 popd
56 '';
57
58 pythonImportsCheck = [ "yarl" ];
59
60 meta = with lib; {
61 changelog = "https://github.com/aio-libs/yarl/blob/v${version}/CHANGES.rst";
62 description = "Yet another URL library";
63 homepage = "https://github.com/aio-libs/yarl";
64 license = licenses.asl20;
65 maintainers = with maintainers; [ dotlambda ];
66 };
67}