1{
2 lib,
3 buildPythonPackage,
4 cargo,
5 fastimport,
6 fetchFromGitHub,
7 gevent,
8 geventhttpclient,
9 git,
10 glibcLocales,
11 gnupg,
12 gpgme,
13 merge3,
14 paramiko,
15 pytestCheckHook,
16 pythonOlder,
17 rich,
18 rustPlatform,
19 rustc,
20 setuptools,
21 setuptools-rust,
22 typing-extensions,
23 urllib3,
24}:
25
26buildPythonPackage rec {
27 pname = "dulwich";
28 version = "0.24.1";
29 pyproject = true;
30
31 disabled = pythonOlder "3.9";
32
33 src = fetchFromGitHub {
34 owner = "jelmer";
35 repo = "dulwich";
36 tag = "dulwich-${version}";
37 hash = "sha256-GGVvTKDLWPcx1f28Esl9sDXj33157NhSssYD/C+fLy4=";
38 };
39
40 cargoDeps = rustPlatform.fetchCargoVendor {
41 inherit pname version src;
42 hash = "sha256-qGAvy0grueKI+A0nsXntf/EWtozSc138iFDhlfiktK8=";
43 };
44
45 nativeBuildInputs = [
46 rustPlatform.cargoSetupHook
47 cargo
48 rustc
49 ];
50
51 build-system = [
52 setuptools
53 setuptools-rust
54 ];
55
56 dependencies = [
57 urllib3
58 ]
59 ++ lib.optionals (pythonOlder "3.11") [
60 typing-extensions
61 ];
62
63 optional-dependencies = {
64 colordiff = [ rich ];
65 fastimport = [ fastimport ];
66 https = [ urllib3 ];
67 merge = [ merge3 ];
68 pgp = [
69 gpgme
70 gnupg
71 ];
72 paramiko = [ paramiko ];
73 };
74
75 nativeCheckInputs = [
76 gevent
77 geventhttpclient
78 git
79 glibcLocales
80 pytestCheckHook
81 ]
82 ++ lib.flatten (lib.attrValues optional-dependencies);
83
84 enabledTestPaths = [ "tests" ];
85
86 disabledTests = [
87 # AssertionError: 'C:\\\\foo.bar\\\\baz' != 'C:\\foo.bar\\baz'
88 "test_file_win"
89 # dulwich.errors.NotGitRepository: No git repository was found at .
90 "WorktreeCliTests"
91 # 'SwiftPackData' object has no attribute '_file'
92 "test_iterobjects_subset_all_present"
93 "test_iterobjects_subset_missing_allowed"
94 "test_iterobjects_subset_missing_not_allowed"
95 # Adding a symlink to a directory outside the repo doesn't raise
96 "test_add_symlink_absolute_to_system"
97 ];
98
99 disabledTestPaths = [
100 # requires swift config file
101 "tests/contrib/test_swift_smoke.py"
102 ];
103
104 __darwinAllowLocalNetworking = true;
105
106 pythonImportsCheck = [ "dulwich" ];
107
108 meta = with lib; {
109 description = "Implementation of the Git file formats and protocols";
110 longDescription = ''
111 Dulwich is a Python implementation of the Git file formats and protocols, which
112 does not depend on Git itself. All functionality is available in pure Python.
113 '';
114 homepage = "https://www.dulwich.io/";
115 changelog = "https://github.com/jelmer/dulwich/blob/dulwich-${src.tag}/NEWS";
116 license = with licenses; [
117 asl20
118 gpl2Plus
119 ];
120 maintainers = with maintainers; [ koral ];
121 };
122}