1{ lib
2, stdenv
3, buildPythonPackage
4, fetchpatch
5, fetchPypi
6, cargo
7, configobj
8, cython
9, dulwich
10, fastbencode
11, fastimport
12, pygithub
13, libiconv
14, merge3
15, patiencediff
16, pyyaml
17, urllib3
18, breezy
19, launchpadlib
20, testtools
21, pythonOlder
22, installShellFiles
23, rustPlatform
24, rustc
25, setuptools-gettext
26, setuptools-rust
27, testers
28}:
29
30buildPythonPackage rec {
31 pname = "breezy";
32 version = "3.3.4";
33 format = "pyproject";
34
35 disabled = pythonOlder "3.5";
36
37 src = fetchPypi {
38 inherit pname version;
39 hash = "sha256-fEEvOfo8YWhx+xuiqD/KNstlso5/K1XJnGY64tkLIwE=";
40 };
41
42 patches = [
43 # Explicitly track which URLs are used for GitLab
44 (fetchpatch {
45 url = "https://github.com/breezy-team/breezy/commit/cc9fdf3774253183f726127c2ee191c24640d898.patch";
46 hash = "sha256-HTDAW3CPEZ1YBe0wnv6ncWEd0QRHwHawfTplbVDiOGc=";
47 })
48 ];
49
50 cargoDeps = rustPlatform.importCargoLock {
51 lockFile = ./Cargo.lock;
52 };
53
54 postPatch = ''
55 ln -s ${./Cargo.lock} Cargo.lock
56 '';
57
58 nativeBuildInputs = [
59 cython
60 installShellFiles
61 rustPlatform.cargoSetupHook
62 cargo
63 rustc
64 setuptools-gettext
65 setuptools-rust
66 ];
67
68 buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
69
70 propagatedBuildInputs = [
71 configobj
72 dulwich
73 fastbencode
74 merge3
75 patiencediff
76 pyyaml
77 urllib3
78 ] ++ passthru.optional-dependencies.launchpad
79 ++ passthru.optional-dependencies.fastimport
80 ++ passthru.optional-dependencies.github;
81
82 nativeCheckInputs = [
83 testtools
84 ];
85
86 # multiple failures on sandbox
87 doCheck = false;
88
89 checkPhase = ''
90 runHook preCheck
91
92 HOME=$TMPDIR $out/bin/brz --no-plugins selftest
93
94 runHook postCheck
95 '';
96
97 postInstall = ''
98 wrapProgram $out/bin/brz --prefix PYTHONPATH : "$PYTHONPATH"
99
100 # symlink for bazaar compatibility
101 ln -s "$out/bin/brz" "$out/bin/bzr"
102
103 installShellCompletion --cmd brz --bash contrib/bash/brz
104 '';
105
106 pythonImportsCheck = [
107 "breezy"
108 "breezy.bzr.rio"
109 ];
110
111 passthru = {
112 tests.version = testers.testVersion {
113 package = breezy;
114 command = "HOME=$TMPDIR brz --version";
115 };
116 optional-dependencies = {
117 launchpad = [
118 launchpadlib
119 ];
120 fastimport = [
121 fastimport
122 ];
123 github = [
124 pygithub
125 ];
126 };
127 };
128
129 meta = with lib; {
130 description = "Friendly distributed version control system";
131 homepage = "https://www.breezy-vcs.org/";
132 changelog = "https://github.com/breezy-team/breezy/blob/brz-${version}/doc/en/release-notes/brz-${versions.majorMinor version}.txt";
133 license = licenses.gpl2Only;
134 maintainers = [ maintainers.marsam ];
135 mainProgram = "brz";
136 };
137}