Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at r-updates 156 lines 3.3 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 fetchpatch, 7 pythonAtLeast, 8 pythonOlder, 9 replaceVars, 10 11 # build-system 12 setuptools, 13 14 # patched in 15 geos, 16 gdal, 17 withGdal ? false, 18 19 # dependencies 20 asgiref, 21 sqlparse, 22 23 # optional-dependencies 24 argon2-cffi, 25 bcrypt, 26 27 # tests 28 aiosmtpd, 29 docutils, 30 geoip2, 31 jinja2, 32 numpy, 33 pillow, 34 pylibmc, 35 pymemcache, 36 python, 37 pyyaml, 38 pytz, 39 redis, 40 selenium, 41 tblib, 42 tzdata, 43}: 44 45buildPythonPackage rec { 46 pname = "django"; 47 version = "5.1.11"; 48 pyproject = true; 49 50 disabled = pythonOlder "3.10"; 51 52 src = fetchFromGitHub { 53 owner = "django"; 54 repo = "django"; 55 rev = "refs/tags/${version}"; 56 hash = "sha256-yHoK7NGa91QEVFLeHqJo126qNg1pTE7W6LEtbCLy4sw="; 57 }; 58 59 patches = [ 60 (replaceVars ./django_5_set_zoneinfo_dir.patch { 61 zoneinfo = tzdata + "/share/zoneinfo"; 62 }) 63 # prevent tests from messing with our pythonpath 64 ./django_5_tests_pythonpath.patch 65 # disable test that expects timezone issues 66 ./django_5_disable_failing_tests.patch 67 68 # fix filename length limit tests on bcachefs 69 # FIXME: remove in 5.2 70 (fetchpatch { 71 url = "https://github.com/django/django/commit/12f4f95405c7857cbf2f4bf4d0261154aac31676.patch"; 72 hash = "sha256-+K20/V8sh036Ox9U7CSPgfxue7f28Sdhr3MsB7erVOk="; 73 }) 74 ] 75 ++ lib.optionals (pythonAtLeast "3.13") [ 76 # https://code.djangoproject.com/ticket/36499 77 # https://github.com/django/django/pull/19639 78 ./3.13.6-html-parser.patch 79 ] 80 ++ lib.optionals withGdal [ 81 (replaceVars ./django_5_set_geos_gdal_lib.patch { 82 geos = geos; 83 gdal = gdal; 84 extension = stdenv.hostPlatform.extensions.sharedLibrary; 85 }) 86 ]; 87 88 postPatch = '' 89 substituteInPlace tests/utils_tests/test_autoreload.py \ 90 --replace-fail "/usr/bin/python" "${python.interpreter}" 91 ''; 92 93 build-system = [ setuptools ]; 94 95 dependencies = [ 96 asgiref 97 sqlparse 98 ]; 99 100 optional-dependencies = { 101 argon2 = [ argon2-cffi ]; 102 bcrypt = [ bcrypt ]; 103 }; 104 105 nativeCheckInputs = [ 106 # tests/requirements/py3.txt 107 aiosmtpd 108 docutils 109 geoip2 110 jinja2 111 numpy 112 pillow 113 pylibmc 114 pymemcache 115 pyyaml 116 pytz 117 redis 118 selenium 119 tblib 120 tzdata 121 ] 122 ++ lib.flatten (lib.attrValues optional-dependencies); 123 124 preCheck = '' 125 # make sure the installed library gets imported 126 rm -rf django 127 128 # fails to import github_links from docs/_ext/github_links.py 129 rm tests/sphinx/test_github_links.py 130 131 # provide timezone data, works only on linux 132 export TZDIR=${tzdata}/${python.sitePackages}/tzdata/zoneinfo 133 134 export PYTHONPATH=$PWD/docs/_ext:$PYTHONPATH 135 ''; 136 137 checkPhase = '' 138 runHook preCheck 139 140 pushd tests 141 ${python.interpreter} runtests.py --settings=test_sqlite 142 popd 143 144 runHook postCheck 145 ''; 146 147 __darwinAllowLocalNetworking = true; 148 149 meta = with lib; { 150 changelog = "https://docs.djangoproject.com/en/${lib.versions.majorMinor version}/releases/${version}/"; 151 description = "High-level Python Web framework that encourages rapid development and clean, pragmatic design"; 152 homepage = "https://www.djangoproject.com"; 153 license = licenses.bsd3; 154 maintainers = with maintainers; [ hexa ]; 155 }; 156}