Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / tools / backblaze-b2 / default.nix
blob3bab2e7bba2f4fc3c632c3e3196e2687c4eadf9d
1 { lib, python3Packages, fetchPypi, installShellFiles }:
3 python3Packages.buildPythonApplication rec {
4   pname = "backblaze-b2";
5   version = "3.9.0";
6   format = "setuptools";
8   src = fetchPypi {
9     inherit version;
10     pname = "b2";
11     hash = "sha256-Z9LQapWl0zblcAyMOfKhn5/O1H6+tmgiPQfAB241jqU=";
12   };
14   postPatch = ''
15     substituteInPlace requirements.txt \
16       --replace 'phx-class-registry==4.0.5' 'phx-class-registry'
17     substituteInPlace requirements.txt \
18       --replace 'tabulate==0.8.10' 'tabulate'
19     substituteInPlace setup.py \
20       --replace 'setuptools_scm<6.0' 'setuptools_scm'
21   '';
23   nativeBuildInputs = [
24     installShellFiles
25     python3Packages.setuptools-scm
26   ];
28   propagatedBuildInputs = with python3Packages; [
29     argcomplete
30     arrow
31     b2sdk
32     phx-class-registry
33     setuptools
34     docutils
35     rst2ansi
36     tabulate
37     tqdm
38   ];
40   nativeCheckInputs = with python3Packages; [
41     backoff
42     more-itertools
43     pexpect
44     pytestCheckHook
45   ];
47   preCheck = ''
48     export HOME=$(mktemp -d)
49   '';
51   disabledTests = [
52     # require network
53     "test_files_headers"
54     "test_integration"
56     # fixed by https://github.com/Backblaze/B2_Command_Line_Tool/pull/915
57     "TestRmConsoleTool"
58   ];
60   disabledTestPaths = [
61     # requires network
62     "test/integration/test_b2_command_line.py"
64     # it's hard to make it work on nix
65     "test/integration/test_autocomplete.py"
66   ];
68   postInstall = ''
69     mv "$out/bin/b2" "$out/bin/backblaze-b2"
71     installShellCompletion --cmd backblaze-b2 \
72       --bash <(${python3Packages.argcomplete}/bin/register-python-argcomplete backblaze-b2) \
73       --zsh <(${python3Packages.argcomplete}/bin/register-python-argcomplete backblaze-b2)
74   '';
76   meta = with lib; {
77     description = "Command-line tool for accessing the Backblaze B2 storage service";
78     homepage = "https://github.com/Backblaze/B2_Command_Line_Tool";
79     changelog = "https://github.com/Backblaze/B2_Command_Line_Tool/blob/v${version}/CHANGELOG.md";
80     license = licenses.mit;
81     maintainers = with maintainers; [ hrdinka kevincox tomhoule ];
82   };