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.12";
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-V/SnzpslFGjISg+YxViFa+Lpnn0+9enPA3xmvwfXnUM=";
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 configobj
65 dulwich
66 fastbencode
67 merge3
68 patiencediff
69 pyyaml
70 tzlocal
71 urllib3
72 ]
73 ++ optional-dependencies.launchpad
74 ++ optional-dependencies.fastimport
75 ++ optional-dependencies.github;
76
77 optional-dependencies = {
78 launchpad = [ launchpadlib ];
79 fastimport = [ fastimport ];
80 github = [ pygithub ];
81 };
82
83 nativeCheckInputs = [ testtools ];
84
85 # multiple failures on sandbox
86 doCheck = false;
87
88 checkPhase = ''
89 runHook preCheck
90
91 HOME=$TMPDIR $out/bin/brz --no-plugins selftest
92
93 runHook postCheck
94 '';
95
96 postInstall = ''
97 wrapProgram $out/bin/brz --prefix PYTHONPATH : "$PYTHONPATH"
98
99 # symlink for bazaar compatibility
100 ln -s "$out/bin/brz" "$out/bin/bzr"
101
102 installShellCompletion --cmd brz --bash contrib/bash/brz
103 '';
104
105 pythonImportsCheck = [
106 "breezy"
107 "breezy.bzr.rio"
108 ];
109
110 passthru = {
111 tests.version = testers.testVersion {
112 package = breezy;
113 command = "HOME=$TMPDIR brz --version";
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}