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