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