1{ lib 2, stdenv 3, buildPythonPackage 4, fetchPypi 5, pythonOlder 6, substituteAll 7 8# build 9, setuptools 10 11# patched in 12, geos 13, gdal 14, withGdal ? false 15 16# propagates 17, asgiref 18, sqlparse 19 20# extras 21, argon2-cffi 22, bcrypt 23 24# tests 25, aiosmtpd 26, docutils 27, geoip2 28, jinja2 29, numpy 30, pillow 31, pylibmc 32, pymemcache 33, python 34, pywatchman 35, pyyaml 36, pytz 37, redis 38, selenium 39, tblib 40, tzdata 41}: 42 43buildPythonPackage rec { 44 pname = "Django"; 45 version = "5.0b1"; 46 pyproject = true; 47 48 disabled = pythonOlder "3.10"; 49 50 src = fetchPypi { 51 inherit pname version; 52 hash = "sha256-yIY15zPwoO9GwhljXiHI9ZeOsqFMORgiRlRUG8XVcDA="; 53 }; 54 55 patches = [ 56 (substituteAll { 57 src = ./django_5_set_zoneinfo_dir.patch; 58 zoneinfo = tzdata + "/share/zoneinfo"; 59 }) 60 # prevent tests from messing with our pythonpath 61 ./django_5_tests_pythonpath.patch 62 # disable test that excpects timezone issues 63 ./django_5_disable_failing_tests.patch 64 ] ++ lib.optionals withGdal [ 65 (substituteAll { 66 src = ./django_5_set_geos_gdal_lib.patch; 67 geos = geos; 68 gdal = gdal; 69 extension = stdenv.hostPlatform.extensions.sharedLibrary; 70 }) 71 ]; 72 73 postPatch = '' 74 substituteInPlace tests/utils_tests/test_autoreload.py \ 75 --replace "/usr/bin/python" "${python.interpreter}" 76 ''; 77 78 nativeBuildInputs = [ 79 setuptools 80 ]; 81 82 propagatedBuildInputs = [ 83 asgiref 84 sqlparse 85 ]; 86 87 passthru.optional-dependencies = { 88 argon2 = [ 89 argon2-cffi 90 ]; 91 bcrypt = [ 92 bcrypt 93 ]; 94 }; 95 96 nativeCheckInputs = [ 97 # tests/requirements/py3.txt 98 aiosmtpd 99 docutils 100 geoip2 101 jinja2 102 numpy 103 pillow 104 pylibmc 105 pymemcache 106 pywatchman 107 pyyaml 108 pytz 109 redis 110 selenium 111 tblib 112 tzdata 113 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies); 114 115 doCheck = !stdenv.isDarwin; 116 117 preCheck = '' 118 # make sure the installed library gets imported 119 rm -rf django 120 121 # provide timezone data, works only on linux 122 export TZDIR=${tzdata}/${python.sitePackages}/tzdata/zoneinfo 123 ''; 124 125 checkPhase = '' 126 runHook preCheck 127 128 pushd tests 129 ${python.interpreter} runtests.py --settings=test_sqlite 130 popd 131 132 runHook postCheck 133 ''; 134 135 __darwinAllowLocalNetworking = true; 136 137 meta = with lib; { 138 changelog = "https://docs.djangoproject.com/en/${lib.versions.majorMinor version}/releases/${version}/"; 139 description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design."; 140 homepage = "https://www.djangoproject.com"; 141 license = licenses.bsd3; 142 maintainers = with maintainers; [ hexa ]; 143 }; 144}