1{
2 lib,
3 azure-storage-blob,
4 boto3,
5 buildPythonPackage,
6 cryptography,
7 django,
8 dropbox,
9 fetchFromGitHub,
10 google-cloud-storage,
11 libcloud,
12 moto,
13 paramiko,
14 pytestCheckHook,
15 pythonOlder,
16 rsa,
17 setuptools,
18 pynacl,
19 fetchpatch,
20}:
21
22buildPythonPackage rec {
23 pname = "django-storages";
24 version = "1.14.4";
25 pyproject = true;
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchFromGitHub {
30 owner = "jschneier";
31 repo = "django-storages";
32 rev = "refs/tags/${version}";
33 hash = "sha256-nlM/XPot3auLzNsnHCVtog2WmiaibDRgbPOw9A5F9QI=";
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 # Fix Google Cloud tests
45 # https://github.com/jschneier/django-storages/pull/1476
46 (fetchpatch {
47 url = "https://github.com/jschneier/django-storages/commit/fda4e2375bfc5b400593ce01f6516dc3264d0357.patch";
48 hash = "sha256-Dga4xvCjeKEwuH0ynyJeM0criBtKT6Z+4gINXMKh4Ng=";
49 name = "fix_google_cloud_tests.patch";
50 })
51 ];
52
53 build-system = [ setuptools ];
54
55 dependencies = [ django ];
56
57 optional-dependencies = {
58 azure = [ azure-storage-blob ];
59 boto3 = [ boto3 ];
60 dropbox = [ dropbox ];
61 google = [ google-cloud-storage ];
62 libcloud = [ libcloud ];
63 s3 = [ boto3 ];
64 sftp = [ paramiko ];
65 };
66
67 nativeCheckInputs = [
68 cryptography
69 moto
70 pytestCheckHook
71 rsa
72 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
73
74 checkInputs = [ pynacl ];
75
76 pythonImportsCheck = [ "storages" ];
77
78 env.DJANGO_SETTINGS_MODULE = "tests.settings";
79
80 meta = {
81 description = "Collection of custom storage backends for Django";
82 changelog = "https://github.com/jschneier/django-storages/blob/${version}/CHANGELOG.rst";
83 downloadPage = "https://github.com/jschneier/django-storages/";
84 homepage = "https://django-storages.readthedocs.io";
85 license = lib.licenses.bsd3;
86 maintainers = with lib.maintainers; [ mmai ];
87 };
88}