1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 setuptools,
7 requests,
8 six,
9 stone,
10 urllib3,
11 mock,
12 pytest-mock,
13 pytestCheckHook,
14 sphinxHook,
15 sphinx-rtd-theme,
16 pythonRelaxDepsHook,
17}:
18
19buildPythonPackage rec {
20 pname = "dropbox";
21 version = "12.0.0";
22 pyproject = true;
23
24 disabled = pythonOlder "3.7";
25
26 outputs = [
27 "out"
28 "doc"
29 ];
30
31 src = fetchFromGitHub {
32 owner = "dropbox";
33 repo = "dropbox-sdk-python";
34 rev = "refs/tags/v${version}";
35 hash = "sha256-0MDm6NB+0vkN8QRSHvuDYEyYhYQWQD4jsctyd5fLdwE=";
36 };
37
38 build-system = [ setuptools ];
39
40 dependencies = [
41 requests
42 six
43 stone
44 urllib3
45 ];
46
47 nativeCheckInputs = [
48 mock
49 pytest-mock
50 pytestCheckHook
51 ];
52
53 postPatch = ''
54 substituteInPlace setup.py \
55 --replace "'pytest-runner==5.2.0'," ""
56 '';
57
58 doCheck = true;
59
60 pythonImportsCheck = [ "dropbox" ];
61
62 nativeBuildInputs = [
63 sphinxHook
64 sphinx-rtd-theme
65 pythonRelaxDepsHook
66 ];
67
68 # Version 12.0.0 re-introduced Python 2 support and set some very restrictive version bounds
69 # https://github.com/dropbox/dropbox-sdk-python/commit/75596daf316b4a806f18057e2797a15bdf83cf6d
70 # This will be the last major version to support Python 2, so version bounds might be more reasonable again in the future.
71 pythonRelaxDeps = [
72 "requests"
73 "stone"
74 "urllib3"
75 ];
76
77 # Set SCOPED_USER_DROPBOX_TOKEN environment variable to a valid value.
78 disabledTests = [
79 "test_default_oauth2_urls"
80 "test_bad_auth"
81 "test_multi_auth"
82 "test_refresh"
83 "test_app_auth"
84 "test_downscope"
85 "test_rpc"
86 "test_upload_download"
87 "test_bad_upload_types"
88 "test_clone_when_user_linked"
89 "test_with_path_root_constructor"
90 "test_path_root"
91 "test_path_root_err"
92 "test_versioned_route"
93 "test_team"
94 "test_as_user"
95 "test_as_admin"
96 "test_clone_when_team_linked"
97 "test_bad_pins"
98 "test_bad_pins_session"
99 ];
100
101 meta = with lib; {
102 description = "Python library for Dropbox's HTTP-based Core and Datastore APIs";
103 homepage = "https://github.com/dropbox/dropbox-sdk-python";
104 changelog = "https://github.com/dropbox/dropbox-sdk-python/releases/tag/v${version}";
105 license = licenses.mit;
106 maintainers = with maintainers; [ sfrijters ];
107 };
108}