2018-07-21 01:44:44 +01:00
|
|
|
{ lib, buildPythonApplication, fetchFromGitHub
|
2017-12-02 13:42:13 +00:00
|
|
|
, arrow, futures, logfury, requests, six, tqdm
|
|
|
|
}:
|
2016-02-03 23:45:01 +00:00
|
|
|
|
2017-12-02 13:42:13 +00:00
|
|
|
buildPythonApplication rec {
|
|
|
|
pname = "backblaze-b2";
|
2018-12-16 17:52:13 +00:00
|
|
|
version = "1.3.8";
|
2016-02-03 23:45:01 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Backblaze";
|
|
|
|
repo = "B2_Command_Line_Tool";
|
2017-12-02 13:42:13 +00:00
|
|
|
rev = "v${version}";
|
2018-12-16 17:52:13 +00:00
|
|
|
sha256 = "1y4z4w6fj92rh9mrjsi0nmnzcmrj5jikarq2vs5qznvjdjm62igw";
|
2016-02-03 23:45:01 +00:00
|
|
|
};
|
|
|
|
|
2017-12-02 13:42:13 +00:00
|
|
|
propagatedBuildInputs = [ arrow futures logfury requests six tqdm ];
|
2016-03-06 17:14:25 +00:00
|
|
|
|
2016-02-03 23:45:01 +00:00
|
|
|
checkPhase = ''
|
|
|
|
python test_b2_command_line.py test
|
|
|
|
'';
|
|
|
|
|
2018-09-02 07:45:09 +01:00
|
|
|
postPatch = ''
|
|
|
|
# b2 uses an upper bound on arrow, because arrow 0.12.1 is not
|
|
|
|
# compatible with Python 2.6:
|
|
|
|
#
|
|
|
|
# https://github.com/crsmithdev/arrow/issues/517
|
|
|
|
#
|
|
|
|
# However, since we use Python 2.7, newer versions of arrow are fine.
|
|
|
|
|
|
|
|
sed -i 's/,<0.12.1//g' requirements.txt
|
|
|
|
'';
|
|
|
|
|
2016-03-06 17:14:25 +00:00
|
|
|
postInstall = ''
|
|
|
|
mv "$out/bin/b2" "$out/bin/backblaze-b2"
|
|
|
|
|
2018-09-03 19:57:32 +01:00
|
|
|
sed 's/^_have b2 \&\&$/_have backblaze-b2 \&\&/' -i contrib/bash_completion/b2
|
2016-03-06 17:14:25 +00:00
|
|
|
sed 's/^\(complete -F _b2\) b2/\1 backblaze-b2/' -i contrib/bash_completion/b2
|
|
|
|
|
|
|
|
mkdir -p "$out/etc/bash_completion.d"
|
|
|
|
cp contrib/bash_completion/b2 "$out/etc/bash_completion.d/backblaze-b2"
|
2016-02-03 23:45:01 +00:00
|
|
|
'';
|
|
|
|
|
2017-12-02 13:42:13 +00:00
|
|
|
meta = with lib; {
|
2016-02-27 17:24:00 +00:00
|
|
|
description = "Command-line tool for accessing the Backblaze B2 storage service";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/Backblaze/B2_Command_Line_Tool";
|
2016-03-06 17:14:25 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ hrdinka kevincox ];
|
|
|
|
platforms = platforms.unix;
|
2016-02-03 23:45:01 +00:00
|
|
|
};
|
|
|
|
}
|