nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at r-updates 140 lines 2.8 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 replaceVars, 7 8 # build-system 9 setuptools, 10 11 # patched in 12 geos, 13 gdal, 14 withGdal ? false, 15 16 # dependencies 17 asgiref, 18 sqlparse, 19 20 # optional-dependencies 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 pyyaml, 35 pytz, 36 redis, 37 selenium, 38 tblib, 39 tzdata, 40}: 41 42buildPythonPackage rec { 43 pname = "django"; 44 version = "5.2.11"; 45 pyproject = true; 46 47 src = fetchFromGitHub { 48 owner = "django"; 49 repo = "django"; 50 tag = version; 51 hash = "sha256-Ldscb87ts0CPbt5uBiL3DK3qhU6SzTmsEUl90Afko84="; 52 }; 53 54 patches = [ 55 (replaceVars ./5.2/zoneinfo.patch { 56 zoneinfo = tzdata + "/share/zoneinfo"; 57 }) 58 # prevent tests from messing with our pythonpath 59 ./5.2/pythonpath.patch 60 # disable test that expects timezone issues 61 ./5.2/disable-failing-test.patch 62 ] 63 ++ lib.optionals withGdal [ 64 (replaceVars ./5.2/gdal.patch { 65 geos = geos; 66 gdal = gdal; 67 extension = stdenv.hostPlatform.extensions.sharedLibrary; 68 }) 69 ]; 70 71 postPatch = '' 72 substituteInPlace tests/utils_tests/test_autoreload.py \ 73 --replace-fail "/usr/bin/python" "${python.interpreter}" 74 ''; 75 76 build-system = [ setuptools ]; 77 78 dependencies = [ 79 asgiref 80 sqlparse 81 ]; 82 83 optional-dependencies = { 84 argon2 = [ argon2-cffi ]; 85 bcrypt = [ bcrypt ]; 86 }; 87 88 nativeCheckInputs = [ 89 # tests/requirements/py3.txt 90 aiosmtpd 91 docutils 92 geoip2 93 jinja2 94 numpy 95 pillow 96 pylibmc 97 pymemcache 98 pyyaml 99 pytz 100 redis 101 selenium 102 tblib 103 tzdata 104 ] 105 ++ lib.concatAttrValues optional-dependencies; 106 107 preCheck = '' 108 # make sure the installed library gets imported 109 rm -rf django 110 111 # fails to import github_links from docs/_ext/github_links.py 112 rm tests/sphinx/test_github_links.py 113 114 # provide timezone data, works only on linux 115 export TZDIR=${tzdata}/${python.sitePackages}/tzdata/zoneinfo 116 117 export PYTHONPATH=$PWD/docs/_ext:$PYTHONPATH 118 ''; 119 120 checkPhase = '' 121 runHook preCheck 122 123 pushd tests 124 # without --parallel=1, tests fail with an "unexpected error due to a database lock" on Darwin 125 ${python.interpreter} runtests.py --settings=test_sqlite ${lib.optionalString stdenv.hostPlatform.isDarwin "--parallel=1"} 126 popd 127 128 runHook postCheck 129 ''; 130 131 __darwinAllowLocalNetworking = true; 132 133 meta = { 134 changelog = "https://docs.djangoproject.com/en/${lib.versions.majorMinor version}/releases/${version}/"; 135 description = "High-level Python Web framework that encourages rapid development and clean, pragmatic design"; 136 homepage = "https://www.djangoproject.com"; 137 license = lib.licenses.bsd3; 138 maintainers = with lib.maintainers; [ hexa ]; 139 }; 140}