From cdac967ea9d6b92f466da0b5d38b560b602b5212 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Tue, 15 Jul 2025 15:17:15 +0000 Subject: [PATCH] python3Packages.pytz: use system tzdata We update that one more reliably, and it allows system-level customizations to apply to pytz as well. This is in line with the zoneinfo stdlib module in Python >=v3.9 which accesses the system timezone database directly. This is modeled on how the certifi module uses the system-wide ca-bundle, see commit 8d7cc9cac9ecdf95f554c5ea7ca15118baa06c39. --- pkgs/development/python-modules/pytz/default.nix | 12 +++++++++++- pkgs/top-level/python-packages.nix | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/pytz/default.nix b/pkgs/development/python-modules/pytz/default.nix index d258ad926ec2..5049c209f088 100644 --- a/pkgs/development/python-modules/pytz/default.nix +++ b/pkgs/development/python-modules/pytz/default.nix @@ -3,6 +3,7 @@ buildPythonPackage, fetchPypi, setuptools, + tzdata, unittestCheckHook, }: @@ -16,6 +17,12 @@ buildPythonPackage rec { hash = "sha256-NguePbtJognCGtYYCcf7RTZD4EiziSTHZYE1RnRugcM="; }; + postPatch = '' + # Use our system-wide zoneinfo dir instead of the bundled one + rm -rf pytz/zoneinfo + ln -snvf ${tzdata}/share/zoneinfo pytz/zoneinfo + ''; + build-system = [ setuptools ]; nativeCheckInputs = [ unittestCheckHook ]; @@ -32,6 +39,9 @@ buildPythonPackage rec { description = "World timezone definitions, modern and historical"; homepage = "https://pythonhosted.org/pytz"; license = licenses.mit; - maintainers = with maintainers; [ dotlambda ]; + maintainers = with maintainers; [ + dotlambda + jherland + ]; }; } diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index e398e398f8a4..71d84a38372a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -15008,7 +15008,9 @@ self: super: with self; { pytweening = callPackage ../development/python-modules/pytweening { }; - pytz = callPackage ../development/python-modules/pytz { }; + pytz = callPackage ../development/python-modules/pytz { + inherit (pkgs) tzdata; + }; pytz-deprecation-shim = callPackage ../development/python-modules/pytz-deprecation-shim { };