2023-10-04 02:27:25 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
2024-05-06 21:06:44 +00:00
|
|
|
fetchFromGitHub,
|
2023-10-04 02:27:25 +00:00
|
|
|
pythonOlder,
|
|
|
|
substituteAll,
|
|
|
|
|
2024-04-06 00:03:59 +00:00
|
|
|
# build-system
|
2023-10-04 02:27:25 +00:00
|
|
|
setuptools,
|
|
|
|
|
|
|
|
# patched in
|
|
|
|
geos,
|
|
|
|
gdal,
|
|
|
|
withGdal ? false,
|
|
|
|
|
2024-04-06 00:03:59 +00:00
|
|
|
# dependencies
|
2023-10-04 02:27:25 +00:00
|
|
|
asgiref,
|
|
|
|
sqlparse,
|
|
|
|
|
2024-04-06 00:03:59 +00:00
|
|
|
# optional-dependencies
|
2023-10-04 02:27:25 +00:00
|
|
|
argon2-cffi,
|
|
|
|
bcrypt,
|
|
|
|
|
|
|
|
# tests
|
|
|
|
aiosmtpd,
|
|
|
|
docutils,
|
|
|
|
geoip2,
|
|
|
|
jinja2,
|
|
|
|
numpy,
|
|
|
|
pillow,
|
|
|
|
pylibmc,
|
|
|
|
pymemcache,
|
|
|
|
python,
|
|
|
|
pywatchman,
|
|
|
|
pyyaml,
|
|
|
|
pytz,
|
|
|
|
redis,
|
|
|
|
selenium,
|
|
|
|
tblib,
|
|
|
|
tzdata,
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2024-03-13 21:42:24 +00:00
|
|
|
pname = "django";
|
2024-11-05 14:07:33 +00:00
|
|
|
version = "5.1.3";
|
2023-10-04 02:27:25 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.10";
|
|
|
|
|
2024-05-06 21:06:44 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "django";
|
|
|
|
repo = "django";
|
|
|
|
rev = "refs/tags/${version}";
|
2024-11-05 14:07:33 +00:00
|
|
|
hash = "sha256-TqOVe+QkwNx/SpI/6X/AQaqLHk3LDSupoRl3RKL6kac=";
|
2023-10-04 02:27:25 +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;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-09-04 01:00:19 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace-fail "setuptools>=61.0.0,<69.3.0" setuptools
|
|
|
|
|
|
|
|
substituteInPlace tests/utils_tests/test_autoreload.py \
|
|
|
|
--replace-fail "/usr/bin/python" "${python.interpreter}"
|
|
|
|
'';
|
2023-10-04 02:27:25 +00:00
|
|
|
|
2024-04-06 00:03:59 +00:00
|
|
|
build-system = [ setuptools ];
|
2023-10-04 02:27:25 +00:00
|
|
|
|
2024-04-06 00:03:59 +00:00
|
|
|
dependencies = [
|
2023-10-04 02:27:25 +00:00
|
|
|
asgiref
|
|
|
|
sqlparse
|
|
|
|
];
|
|
|
|
|
2024-04-06 00:03:59 +00:00
|
|
|
optional-dependencies = {
|
2023-10-04 02:27:25 +00:00
|
|
|
argon2 = [ argon2-cffi ];
|
|
|
|
bcrypt = [ bcrypt ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
# tests/requirements/py3.txt
|
|
|
|
aiosmtpd
|
|
|
|
docutils
|
|
|
|
geoip2
|
|
|
|
jinja2
|
|
|
|
numpy
|
|
|
|
pillow
|
|
|
|
pylibmc
|
|
|
|
pymemcache
|
|
|
|
pywatchman
|
|
|
|
pyyaml
|
|
|
|
pytz
|
|
|
|
redis
|
|
|
|
selenium
|
|
|
|
tblib
|
|
|
|
tzdata
|
2024-04-06 00:03:59 +00:00
|
|
|
] ++ lib.flatten (lib.attrValues optional-dependencies);
|
2023-10-04 02:27:25 +00:00
|
|
|
|
|
|
|
doCheck = !stdenv.hostPlatform.isDarwin;
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
# make sure the installed library gets imported
|
|
|
|
rm -rf django
|
|
|
|
|
2024-09-04 01:00:19 +00:00
|
|
|
# fails to import github_links from docs/_ext/github_links.py
|
|
|
|
rm tests/sphinx/test_github_links.py
|
|
|
|
|
2023-10-04 02:27:25 +00:00
|
|
|
# provide timezone data, works only on linux
|
|
|
|
export TZDIR=${tzdata}/${python.sitePackages}/tzdata/zoneinfo
|
2024-09-04 01:00:19 +00:00
|
|
|
|
|
|
|
export PYTHONPATH=$PWD/docs/_ext:$PYTHONPATH
|
2023-10-04 02:27:25 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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}/";
|
|
|
|
description = "High-level Python Web framework that encourages rapid development and clean, pragmatic design";
|
|
|
|
homepage = "https://www.djangoproject.com";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ hexa ];
|
|
|
|
};
|
|
|
|
}
|