1{ lib 2, stdenv 3, buildPythonPackage 4, fetchPypi 5, pythonOlder 6, substituteAll 7 8# build 9, setuptools 10 11# patched in 12, fetchpatch 13, geos 14, gdal 15, withGdal ? false 16 17# propagated 18, asgiref 19, backports-zoneinfo 20, sqlparse 21 22# tests 23, aiosmtpd 24, argon2-cffi 25, bcrypt 26, docutils 27, geoip2 28, jinja2 29, python-memcached 30, numpy 31, pillow 32, pylibmc 33, pymemcache 34, python 35, pytz 36, pywatchman 37, pyyaml 38, redis 39, selenium 40, tblib 41, tzdata 42}: 43 44buildPythonPackage rec { 45 pname = "Django"; 46 version = "4.1.3"; 47 format = "pyproject"; 48 49 disabled = pythonOlder "3.8"; 50 51 src = fetchPypi { 52 inherit pname version; 53 hash = "sha256-Z4u/yGBOskbtVOIGPwdl8TsyGlBSa9yMsflD7af6MfE="; 54 }; 55 56 patches = [ 57 (substituteAll { 58 src = ./django_4_set_zoneinfo_dir.patch; 59 zoneinfo = tzdata + "/share/zoneinfo"; 60 }) 61 ] ++ lib.optionals withGdal [ 62 (substituteAll { 63 src = ./django_4_set_geos_gdal_lib.patch; 64 geos = geos; 65 gdal = gdal; 66 extension = stdenv.hostPlatform.extensions.sharedLibrary; 67 }) 68 ]; 69 70 nativeBuildInputs = [ 71 setuptools 72 ]; 73 74 propagatedBuildInputs = [ 75 asgiref 76 sqlparse 77 ] ++ lib.optionals (pythonOlder "3.9") [ 78 backports-zoneinfo 79 ]; 80 81 # Fails to import asgiref in ~200 tests 82 # ModuleNotFoundError: No module named 'asgiref' 83 doCheck = false; 84 85 checkInputs = [ 86 aiosmtpd 87 argon2-cffi 88 asgiref 89 bcrypt 90 docutils 91 geoip2 92 jinja2 93 python-memcached 94 numpy 95 pillow 96 pylibmc 97 pymemcache 98 pytz 99 pywatchman 100 pyyaml 101 redis 102 selenium 103 tblib 104 tzdata 105 ]; 106 107 checkPhase = '' 108 runHook preCheck 109 110 ${python.interpreter} tests/runtests.py 111 112 runHook postCheck 113 ''; 114 115 meta = with lib; { 116 description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design."; 117 homepage = "https://www.djangoproject.com"; 118 license = licenses.bsd3; 119 maintainers = with maintainers; [ hexa ]; 120 }; 121}