1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fastimport,
6 fetchFromGitHub,
7 fetchpatch2,
8 gevent,
9 geventhttpclient,
10 git,
11 glibcLocales,
12 gnupg,
13 gpgme,
14 paramiko,
15 unittestCheckHook,
16 pythonOlder,
17 setuptools,
18 setuptools-rust,
19 urllib3,
20}:
21
22buildPythonPackage rec {
23 version = "0.22.1";
24 pname = "dulwich";
25 format = "setuptools";
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchFromGitHub {
30 owner = "jelmer";
31 repo = "dulwich";
32 rev = "refs/tags/dulwich-${version}";
33 hash = "sha256-bf3ZUMX4afpdTBpFnx0HMyzCNG6V/p4eOl36djxGbtk=";
34 };
35
36 patches = [
37 (fetchpatch2 {
38 name = "dulwich-geventhttpclient-api-breakage.patch";
39 url = "https://github.com/jelmer/dulwich/commit/5f0497de9c37ac4f4e8f27bed8decce13765d3df.patch";
40 hash = "sha256-0GgDgmYuLCsMc9nRRLNL2W6WYrkZ/1ZnZBQusEAzLKI=";
41 })
42 ];
43
44 build-system = [
45 setuptools
46 setuptools-rust
47 ];
48
49 propagatedBuildInputs = [
50 urllib3
51 ];
52
53 optional-dependencies = {
54 fastimport = [ fastimport ];
55 https = [ urllib3 ];
56 pgp = [
57 gpgme
58 gnupg
59 ];
60 paramiko = [ paramiko ];
61 };
62
63 nativeCheckInputs =
64 [
65 gevent
66 geventhttpclient
67 git
68 glibcLocales
69 unittestCheckHook
70 ]
71 ++ lib.flatten (lib.attrValues optional-dependencies);
72
73 preCheck = ''
74 # requires swift config file
75 rm tests/contrib/test_swift_smoke.py
76
77 # ImportError: attempted relative import beyond top-level package
78 rm tests/test_greenthreads.py
79 '';
80
81 doCheck = !stdenv.isDarwin;
82
83 pythonImportsCheck = [ "dulwich" ];
84
85 meta = with lib; {
86 description = "Implementation of the Git file formats and protocols";
87 longDescription = ''
88 Dulwich is a Python implementation of the Git file formats and protocols, which
89 does not depend on Git itself. All functionality is available in pure Python.
90 '';
91 homepage = "https://www.dulwich.io/";
92 changelog = "https://github.com/jelmer/dulwich/blob/dulwich-${version}/NEWS";
93 license = with licenses; [
94 asl20
95 gpl2Plus
96 ];
97 maintainers = with maintainers; [ koral ];
98 };
99}