Files
nixpkgs/pkgs/development/python-modules/pytz/default.nix
Johan Herland cdac967ea9 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 8d7cc9cac9.
2025-08-09 18:57:49 +02:00

48 lines
950 B
Nix

{
lib,
buildPythonPackage,
fetchPypi,
setuptools,
tzdata,
unittestCheckHook,
}:
buildPythonPackage rec {
pname = "pytz";
version = "2025.2";
pyproject = true;
src = fetchPypi {
inherit pname version;
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 ];
unittestFlagsArray = [
"-s"
"pytz/tests"
];
pythonImportsCheck = [ "pytz" ];
meta = with lib; {
changelog = "https://launchpad.net/pytz/+announcements";
description = "World timezone definitions, modern and historical";
homepage = "https://pythonhosted.org/pytz";
license = licenses.mit;
maintainers = with maintainers; [
dotlambda
jherland
];
};
}