Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / breezy / default.nix
blob505137993b081a423587b3d5bf1e7ce97430c836
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
30 buildPythonPackage rec {
31   pname = "breezy";
32   version = "3.3.4";
33   format = "pyproject";
35   disabled = pythonOlder "3.5";
37   src = fetchPypi {
38     inherit pname version;
39     hash = "sha256-fEEvOfo8YWhx+xuiqD/KNstlso5/K1XJnGY64tkLIwE=";
40   };
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   ];
50   cargoDeps = rustPlatform.importCargoLock {
51     lockFile = ./Cargo.lock;
52   };
54   postPatch = ''
55     ln -s ${./Cargo.lock} Cargo.lock
56   '';
58   nativeBuildInputs = [
59     cython
60     installShellFiles
61     rustPlatform.cargoSetupHook
62     cargo
63     rustc
64     setuptools-gettext
65     setuptools-rust
66   ];
68   buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
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;
82   nativeCheckInputs = [
83     testtools
84   ];
86   # multiple failures on sandbox
87   doCheck = false;
89   checkPhase = ''
90     runHook preCheck
92     HOME=$TMPDIR $out/bin/brz --no-plugins selftest
94     runHook postCheck
95   '';
97   postInstall = ''
98     wrapProgram $out/bin/brz --prefix PYTHONPATH : "$PYTHONPATH"
100     # symlink for bazaar compatibility
101     ln -s "$out/bin/brz" "$out/bin/bzr"
103     installShellCompletion --cmd brz --bash contrib/bash/brz
104   '';
106   pythonImportsCheck = [
107     "breezy"
108     "breezy.bzr.rio"
109   ];
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   };
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   };