1{ fetchFromGitHub, makeWrapper, pythonPackages, stdenv }:
2
3pythonPackages.buildPythonApplication rec {
4 name = "backblaze-b2-${version}";
5 version = "0.6.2";
6
7 src = fetchFromGitHub {
8 owner = "Backblaze";
9 repo = "B2_Command_Line_Tool";
10 rev = "3a4cd3f0b5309f79f98c2e0d51afc19fb2fe4201";
11 sha256 = "1gl1z7zg3s1xgx45i6b1bvx9iwviiiinl4my00h66qkhrw7ag8p1";
12 };
13
14 propagatedBuildInputs = with pythonPackages; [ futures requests2 six tqdm4 ];
15
16 checkPhase = ''
17 python test_b2_command_line.py test
18 '';
19
20 postInstall = ''
21 mv "$out/bin/b2" "$out/bin/backblaze-b2"
22
23 sed 's/^have b2 \&\&$/have backblaze-b2 \&\&/' -i contrib/bash_completion/b2
24 sed 's/^\(complete -F _b2\) b2/\1 backblaze-b2/' -i contrib/bash_completion/b2
25
26 mkdir -p "$out/etc/bash_completion.d"
27 cp contrib/bash_completion/b2 "$out/etc/bash_completion.d/backblaze-b2"
28 '';
29
30 meta = with stdenv.lib; {
31 description = "Command-line tool for accessing the Backblaze B2 storage service";
32 homepage = https://github.com/Backblaze/B2_Command_Line_Tool;
33 license = licenses.mit;
34 maintainers = with maintainers; [ hrdinka kevincox ];
35 platforms = platforms.unix;
36 };
37}