7 # executable is renamed to backblaze-b2 by default, to avoid collision with boost's 'b2'
8 , execName ? "backblaze-b2"
11 python3Packages.buildPythonApplication rec {
12 pname = "backblaze-b2";
16 src = fetchFromGitHub {
18 repo = "B2_Command_Line_Tool";
19 rev = "refs/tags/v${version}";
20 hash = "sha256-1UXByc3jjp8GN7+aI2GBohJ0DFxgp604QOsXp5GaL4Q=";
27 build-system = with python3Packages; [
31 dependencies = with python3Packages; [
45 nativeCheckInputs = with python3Packages; [
54 export HOME=$(mktemp -d)
58 # Test requires network
59 "test/integration/test_b2_command_line.py"
60 "test/integration/test_tqdm_closer.py"
61 # it's hard to make it work on nix
62 "test/integration/test_autocomplete.py"
63 "test/unit/test_console_tool.py"
64 # this one causes successive tests to fail
65 "test/unit/_cli/test_autocomplete_cache.py"
69 # Autocomplete is not successful in a sandbox
70 "test_autocomplete_installer"
72 "test_install_autocomplete"
75 postInstall = lib.optionalString (execName != "b2") ''
76 mv "$out/bin/b2" "$out/bin/${execName}"
79 installShellCompletion --cmd ${execName} \
80 --bash <(${python3Packages.argcomplete}/bin/register-python-argcomplete ${execName}) \
81 --zsh <(${python3Packages.argcomplete}/bin/register-python-argcomplete ${execName})
84 passthru.tests.version = (testers.testVersion {
85 package = backblaze-b2;
86 command = "${execName} version --short";
87 }).overrideAttrs (old: {
88 # workaround the error: Permission denied: '/homeless-shelter'
89 # backblaze-b2 fails to create a 'b2' directory under the XDG config path
91 export HOME=$(mktemp -d)
96 description = "Command-line tool for accessing the Backblaze B2 storage service";
97 homepage = "https://github.com/Backblaze/B2_Command_Line_Tool";
98 changelog = "https://github.com/Backblaze/B2_Command_Line_Tool/blob/v${version}/CHANGELOG.md";
99 license = licenses.mit;
100 maintainers = with maintainers; [ hrdinka tomhoule ];
101 mainProgram = "backblaze-b2";