1{
2 lib,
3 azure-storage-blob,
4 boto3,
5 buildPythonPackage,
6 cryptography,
7 django,
8 dropbox,
9 fetchFromGitHub,
10 fetchpatch,
11 google-cloud-storage,
12 libcloud,
13 moto,
14 paramiko,
15 pynacl,
16 pytestCheckHook,
17 pythonOlder,
18 rsa,
19 setuptools,
20}:
21
22buildPythonPackage rec {
23 pname = "django-storages";
24 version = "1.14.6";
25 pyproject = true;
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchFromGitHub {
30 owner = "jschneier";
31 repo = "django-storages";
32 tag = version;
33 hash = "sha256-br7JGPf5EAAl0Qg7b+XaksxNPCTJsSS8HLgvA0wZmeI=";
34 };
35
36 patches = [
37 # Add Moto 5 support
38 # https://github.com/jschneier/django-storages/pull/1464
39 (fetchpatch {
40 url = "https://github.com/jschneier/django-storages/commit/e1aedcf2d137f164101d31f2f430f1594eedd78c.patch";
41 hash = "sha256-jSb/uJ0RXvPsXl+WUAzAgDvJl9Y3ad2F30X1SbsCc04=";
42 name = "add_moto_5_support.patch";
43 })
44 ];
45
46 build-system = [ setuptools ];
47
48 dependencies = [ django ];
49
50 optional-dependencies = {
51 azure = [ azure-storage-blob ];
52 boto3 = [ boto3 ];
53 dropbox = [ dropbox ];
54 google = [ google-cloud-storage ];
55 libcloud = [ libcloud ];
56 s3 = [ boto3 ];
57 sftp = [ paramiko ];
58 };
59
60 nativeCheckInputs = [
61 cryptography
62 moto
63 pytestCheckHook
64 rsa
65 ]
66 ++ lib.flatten (builtins.attrValues optional-dependencies);
67
68 checkInputs = [ pynacl ];
69
70 pythonImportsCheck = [ "storages" ];
71
72 env.DJANGO_SETTINGS_MODULE = "tests.settings";
73
74 meta = {
75 description = "Collection of custom storage backends for Django";
76 changelog = "https://github.com/jschneier/django-storages/blob/${version}/CHANGELOG.rst";
77 downloadPage = "https://github.com/jschneier/django-storages/";
78 homepage = "https://django-storages.readthedocs.io";
79 license = lib.licenses.bsd3;
80 maintainers = with lib.maintainers; [ mmai ];
81 };
82}