From f9ae2b7dac309b0b085840655051cd98a814fff0 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sat, 29 Aug 2020 14:57:03 +0200 Subject: [PATCH] pythonPackages.django_3: init at 3.1 --- pkgs/development/python-modules/django/3.nix | 48 +++++++++++++++++++ .../django/django_3_set_geos_gdal_lib.patch | 24 ++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 74 insertions(+) create mode 100644 pkgs/development/python-modules/django/3.nix create mode 100644 pkgs/development/python-modules/django/django_3_set_geos_gdal_lib.patch diff --git a/pkgs/development/python-modules/django/3.nix b/pkgs/development/python-modules/django/3.nix new file mode 100644 index 000000000000..dc8a40a3d88e --- /dev/null +++ b/pkgs/development/python-modules/django/3.nix @@ -0,0 +1,48 @@ +{ stdenv +, buildPythonPackage +, fetchPypi +, substituteAll +, geos +, gdal +, asgiref +, pytz +, sqlparse +, pythonOlder +, withGdal ? false +}: + +buildPythonPackage rec { + pname = "Django"; + version = "3.1"; + + disabled = pythonOlder "3.7"; + + src = fetchPypi { + inherit pname version; + sha256 = "2d390268a13c655c97e0e2ede9d117007996db692c1bb93eabebd4fb7ea7012b"; + }; + + patches = stdenv.lib.optional withGdal + (substituteAll { + src = ./django_3_set_geos_gdal_lib.patch; + geos = geos; + gdal = gdal; + extension = stdenv.hostPlatform.extensions.sharedLibrary; + }); + + propagatedBuildInputs = [ + asgiref + pytz + sqlparse + ]; + + # too complicated to setup + doCheck = false; + + meta = with stdenv.lib; { + description = "A high-level Python Web framework"; + homepage = "https://www.djangoproject.com/"; + license = licenses.bsd3; + maintainers = with maintainers; [ georgewhewell lsix ]; + }; +} diff --git a/pkgs/development/python-modules/django/django_3_set_geos_gdal_lib.patch b/pkgs/development/python-modules/django/django_3_set_geos_gdal_lib.patch new file mode 100644 index 000000000000..6b853f8d85f0 --- /dev/null +++ b/pkgs/development/python-modules/django/django_3_set_geos_gdal_lib.patch @@ -0,0 +1,24 @@ +diff -Nur a/django/contrib/gis/gdal/libgdal.py b/django/contrib/gis/gdal/libgdal.py +--- a/django/contrib/gis/gdal/libgdal.py 2020-07-09 22:34:05.330568948 +0100 ++++ b/django/contrib/gis/gdal/libgdal.py 2020-07-09 22:35:08.679095615 +0100 +@@ -14,7 +14,7 @@ + from django.conf import settings + lib_path = settings.GDAL_LIBRARY_PATH + except (AttributeError, ImportError, ImproperlyConfigured, OSError): +- lib_path = None ++ lib_path = "@gdal@/lib/libgdal@extension@" + + if lib_path: + lib_names = None +diff -Nur a/django/contrib/gis/geos/libgeos.py b/django/contrib/gis/geos/libgeos.py +--- a/django/contrib/gis/geos/libgeos.py 2020-07-09 22:34:05.331568941 +0100 ++++ b/django/contrib/gis/geos/libgeos.py 2020-07-09 22:36:24.863526276 +0100 +@@ -24,7 +24,7 @@ + from django.conf import settings + lib_path = settings.GEOS_LIBRARY_PATH + except (AttributeError, ImportError, ImproperlyConfigured, OSError): +- lib_path = None ++ lib_path = "@geos@/lib/libgeos_c@extension@" + + # Setting the appropriate names for the GEOS-C library. + if lib_path: diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 945f55adc70d..cf6b4235090c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1599,6 +1599,8 @@ in { django_2_2 = callPackage ../development/python-modules/django/2_2.nix { }; + django_3 = callPackage ../development/python-modules/django/3.nix { }; + django-allauth = callPackage ../development/python-modules/django-allauth { }; django-anymail = callPackage ../development/python-modules/django-anymail { };