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