Merge pull request #187436 from mweinelt/django_4_zoneinfo

This commit is contained in:
Martin Weinelt 2022-08-19 14:04:19 +02:00 committed by GitHub
commit 5816cce259
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -58,6 +58,10 @@ buildPythonPackage rec {
hash = "sha256-QE7QnfYAK74wvK8gDJ15FtQ+BCIWRQKAVvM7v1FzwlE=";
excludes = [ "docs/releases/4.1.1.txt" ];
})
(substituteAll {
src = ./django_4_set_zoneinfo_dir.patch;
zoneinfo = tzdata + "/share/zoneinfo";
})
] ++ lib.optionals withGdal [
(substituteAll {
src = ./django_4_set_geos_gdal_lib.patch;

View file

@ -0,0 +1,13 @@
diff --git a/django/conf/__init__.py b/django/conf/__init__.py
index cb70a71791..5156f7dd73 100644
--- a/django/conf/__init__.py
+++ b/django/conf/__init__.py
@@ -227,7 +227,7 @@ class Settings:
if hasattr(time, "tzset") and self.TIME_ZONE:
# When we can, attempt to validate the timezone. If we can't find
# this file, no check happens and it's harmless.
- zoneinfo_root = Path("/usr/share/zoneinfo")
+ zoneinfo_root = Path("@zoneinfo@")
zone_info_file = zoneinfo_root.joinpath(*self.TIME_ZONE.split("/"))
if zoneinfo_root.exists() and not zone_info_file.exists():
raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)