144 lines
2.5 KiB
Nix
144 lines
2.5 KiB
Nix
{ lib
|
|
, stdenv
|
|
, buildPythonPackage
|
|
, fetchPypi
|
|
, pythonOlder
|
|
, substituteAll
|
|
|
|
# build
|
|
, setuptools
|
|
|
|
# patched in
|
|
, geos
|
|
, gdal
|
|
, withGdal ? false
|
|
|
|
# propagates
|
|
, asgiref
|
|
, sqlparse
|
|
|
|
# extras
|
|
, argon2-cffi
|
|
, bcrypt
|
|
|
|
# tests
|
|
, aiosmtpd
|
|
, docutils
|
|
, geoip2
|
|
, jinja2
|
|
, numpy
|
|
, pillow
|
|
, pylibmc
|
|
, pymemcache
|
|
, python
|
|
, pywatchman
|
|
, pyyaml
|
|
, pytz
|
|
, redis
|
|
, selenium
|
|
, tblib
|
|
, tzdata
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "Django";
|
|
version = "4.2.4";
|
|
format = "pyproject";
|
|
|
|
disabled = pythonOlder "3.10";
|
|
|
|
src = fetchPypi {
|
|
inherit pname version;
|
|
hash = "sha256-fkIl7AZeDzVMz3NJoi0gneCcwcB0gyvp64TFHBeZxDI=";
|
|
};
|
|
|
|
patches = [
|
|
(substituteAll {
|
|
src = ./django_4_set_zoneinfo_dir.patch;
|
|
zoneinfo = tzdata + "/share/zoneinfo";
|
|
})
|
|
# make sure the tests don't remove packages from our pythonpath
|
|
# and disable failing tests
|
|
./django_4_tests.patch
|
|
] ++ lib.optionals withGdal [
|
|
(substituteAll {
|
|
src = ./django_4_set_geos_gdal_lib.patch;
|
|
geos = geos;
|
|
gdal = gdal;
|
|
extension = stdenv.hostPlatform.extensions.sharedLibrary;
|
|
})
|
|
];
|
|
|
|
postPatch = ''
|
|
substituteInPlace tests/utils_tests/test_autoreload.py \
|
|
--replace "/usr/bin/python" "${python.interpreter}"
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
setuptools
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
asgiref
|
|
sqlparse
|
|
];
|
|
|
|
passthru.optional-dependencies = {
|
|
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
|
|
] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
|
|
|
|
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}/";
|
|
description = "A 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 ];
|
|
};
|
|
}
|