1{ lib
2, arrow
3, buildPythonPackage
4, fetchPypi
5, importlib-metadata
6, isPy27
7, logfury
8, pytestCheckHook
9, pytest-lazy-fixture
10, pytest-mock
11, pythonOlder
12, requests
13, setuptools-scm
14, tqdm
15}:
16
17buildPythonPackage rec {
18 pname = "b2sdk";
19 version = "1.7.0";
20 disabled = isPy27;
21
22 src = fetchPypi {
23 inherit pname version;
24 sha256 = "sha256-8X5XLh9SxZI1P7/2ZjOy8ipcEzTcriJfGI7KlMXncv4=";
25 };
26
27 nativeBuildInputs = [
28 setuptools-scm
29 ];
30
31 propagatedBuildInputs = [
32 arrow
33 logfury
34 requests
35 tqdm
36 ] ++ lib.optionals (pythonOlder "3.8") [
37 importlib-metadata
38 ];
39
40 checkInputs = [
41 pytestCheckHook
42 pytest-lazy-fixture
43 pytest-mock
44 ];
45
46 postPatch = ''
47 substituteInPlace setup.py \
48 --replace 'setuptools_scm<6.0' 'setuptools_scm'
49 substituteInPlace requirements.txt \
50 --replace 'arrow>=0.8.0,<1.0.0' 'arrow'
51 '';
52
53 disabledTests = [
54 # Test requires an API key
55 "test_raw_api"
56 "test_files_headers"
57 ];
58
59 pythonImportsCheck = [ "b2sdk" ];
60
61 meta = with lib; {
62 description = "Client library and utilities for access to B2 Cloud Storage (backblaze)";
63 homepage = "https://github.com/Backblaze/b2-sdk-python";
64 license = licenses.mit;
65 };
66}