2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonAtLeast,
|
|
|
|
pythonOlder,
|
|
|
|
substituteAll,
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# build-system
|
|
|
|
setuptools,
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# patched in
|
|
|
|
geos,
|
|
|
|
gdal,
|
|
|
|
withGdal ? false,
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# dependencies
|
|
|
|
asgiref,
|
|
|
|
sqlparse,
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# optional-dependencies
|
|
|
|
argon2-cffi,
|
|
|
|
bcrypt,
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# tests
|
|
|
|
aiosmtpd,
|
|
|
|
docutils,
|
|
|
|
geoip2,
|
|
|
|
jinja2,
|
|
|
|
numpy,
|
|
|
|
pillow,
|
|
|
|
pylibmc,
|
|
|
|
pymemcache,
|
|
|
|
python,
|
|
|
|
pywatchman,
|
|
|
|
pyyaml,
|
|
|
|
pytz,
|
|
|
|
redis,
|
|
|
|
selenium,
|
|
|
|
tblib,
|
|
|
|
tzdata,
|
2023-11-16 04:20:00 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2024-04-21 15:54:59 +00:00
|
|
|
pname = "django";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "5.0.5";
|
2023-11-16 04:20:00 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.10";
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "django";
|
|
|
|
repo = "django";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-0/AbPmTl38E9BpHVKs0r79fISjEa1d4XO/se1pA7zxg=";
|
2023-11-16 04:20:00 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
patches =
|
|
|
|
[
|
|
|
|
(substituteAll {
|
|
|
|
src = ./django_5_set_zoneinfo_dir.patch;
|
|
|
|
zoneinfo = tzdata + "/share/zoneinfo";
|
|
|
|
})
|
|
|
|
# prevent tests from messing with our pythonpath
|
|
|
|
./django_5_tests_pythonpath.patch
|
|
|
|
# disable test that excpects timezone issues
|
|
|
|
./django_5_disable_failing_tests.patch
|
|
|
|
]
|
|
|
|
++ lib.optionals withGdal [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./django_5_set_geos_gdal_lib.patch;
|
|
|
|
geos = geos;
|
|
|
|
gdal = gdal;
|
|
|
|
extension = stdenv.hostPlatform.extensions.sharedLibrary;
|
|
|
|
})
|
|
|
|
];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
postPatch =
|
|
|
|
''
|
|
|
|
substituteInPlace tests/utils_tests/test_autoreload.py \
|
|
|
|
--replace "/usr/bin/python" "${python.interpreter}"
|
|
|
|
''
|
|
|
|
+ lib.optionalString (pythonAtLeast "3.12" && stdenv.hostPlatform.system == "aarch64-linux") ''
|
|
|
|
# Test regression after xz was reverted from 5.6.0 to 5.4.6
|
|
|
|
# https://hydra.nixos.org/build/254532197
|
|
|
|
substituteInPlace tests/view_tests/tests/test_debug.py \
|
|
|
|
--replace-fail "test_files" "dont_test_files"
|
|
|
|
'';
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
build-system = [ setuptools ];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
dependencies = [
|
2023-11-16 04:20:00 +00:00
|
|
|
asgiref
|
|
|
|
sqlparse
|
|
|
|
];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
optional-dependencies = {
|
2024-06-05 15:53:02 +00:00
|
|
|
argon2 = [ argon2-cffi ];
|
|
|
|
bcrypt = [ bcrypt ];
|
2023-11-16 04:20:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
# tests/requirements/py3.txt
|
|
|
|
aiosmtpd
|
|
|
|
docutils
|
|
|
|
geoip2
|
|
|
|
jinja2
|
|
|
|
numpy
|
|
|
|
pillow
|
|
|
|
pylibmc
|
|
|
|
pymemcache
|
|
|
|
pywatchman
|
|
|
|
pyyaml
|
|
|
|
pytz
|
|
|
|
redis
|
|
|
|
selenium
|
|
|
|
tblib
|
|
|
|
tzdata
|
2024-04-21 15:54:59 +00:00
|
|
|
] ++ lib.flatten (lib.attrValues optional-dependencies);
|
2023-11-16 04:20:00 +00:00
|
|
|
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
# make sure the installed library gets imported
|
|
|
|
rm -rf django
|
|
|
|
|
|
|
|
# provide timezone data, works only on linux
|
|
|
|
export TZDIR=${tzdata}/${python.sitePackages}/tzdata/zoneinfo
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
pushd tests
|
|
|
|
${python.interpreter} runtests.py --settings=test_sqlite
|
|
|
|
popd
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
changelog = "https://docs.djangoproject.com/en/${lib.versions.majorMinor version}/releases/${version}/";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "High-level Python Web framework that encourages rapid development and clean, pragmatic design";
|
2023-11-16 04:20:00 +00:00
|
|
|
homepage = "https://www.djangoproject.com";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ hexa ];
|
|
|
|
};
|
|
|
|
}
|