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.10";
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-AzMDab8SUJ8JJukqxVsqf7HdCTcVMLyFFTInPwAmSqs=";
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.hostPlatform.isDarwin [ libiconv ];
62
63 propagatedBuildInputs =
64 [
65 configobj
66 dulwich
67 fastbencode
68 merge3
69 patiencediff
70 pyyaml
71 tzlocal
72 urllib3
73 ]
74 ++ optional-dependencies.launchpad
75 ++ optional-dependencies.fastimport
76 ++ optional-dependencies.github;
77
78 optional-dependencies = {
79 launchpad = [ launchpadlib ];
80 fastimport = [ fastimport ];
81 github = [ pygithub ];
82 };
83
84 nativeCheckInputs = [ testtools ];
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 };
117
118 meta = with lib; {
119 description = "Friendly distributed version control system";
120 homepage = "https://www.breezy-vcs.org/";
121 changelog = "https://github.com/breezy-team/breezy/blob/${src.rev}/doc/en/release-notes/brz-${versions.majorMinor version}.txt";
122 license = licenses.gpl2Only;
123 maintainers = [ ];
124 mainProgram = "brz";
125 };
126}