From 64358475b7da8d532a6c28694c8302d900cacf4d Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 19 Sep 2023 04:34:28 +0200 Subject: [PATCH] python311Packages.maya: fix build, reformat make compatible with recent humanize versions, through access of the private _abs_timedelta function. Enable tests. --- .../python-modules/maya/default.nix | 60 ++++++++++++++----- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/pkgs/development/python-modules/maya/default.nix b/pkgs/development/python-modules/maya/default.nix index 707602350544..e96d66826583 100644 --- a/pkgs/development/python-modules/maya/default.nix +++ b/pkgs/development/python-modules/maya/default.nix @@ -1,28 +1,58 @@ -{ lib, fetchPypi, fetchpatch, buildPythonPackage -, dateparser, humanize, pendulum, ruamel-yaml, tzlocal }: +{ lib +, fetchFromGitHub +, buildPythonPackage + +# build-system +, setuptools + +# dependencies +, dateparser +, humanize +, tzlocal +, pendulum +, snaptime +, pytz + +# tests +, freezegun +, pytestCheckHook +}: buildPythonPackage rec { pname = "maya"; version = "0.6.1"; + format = "pyproject"; - src = fetchPypi { - inherit pname version; - sha256 = "sha256-f1PgbVoSNhPc58Jwy8ZHZDppQlkNunoZ7DYZTQM4w/Q="; + src = fetchFromGitHub { + owner = "kennethreitz"; + repo = "maya"; + rev = "refs/tags/v${version}"; + hash = "sha256-4fUyUqVQk/AcQL3xMnU1cQlF5yiD/N9NPAsUPuDTTNY="; }; - patches = [ - (fetchpatch { - # https://github.com/kennethreitz/maya/issues/112 - # Merged, so should be in next release. - url = "https://github.com/kennethreitz/maya/commit/f69a93b1103130139cdec30511777823957fb659.patch"; - sha256 = "152ba7amv9dhhx1wcklfalsdzsxggik9f7rsrikms921lq9xqc8h"; - }) + postPatch = '' + # function was made private in humanize + substituteInPlace maya/core.py \ + --replace "humanize.time.abs_timedelta" "humanize.time._abs_timedelta" + ''; + + nativeBuildInputs = [ + setuptools ]; - propagatedBuildInputs = [ dateparser humanize pendulum ruamel-yaml tzlocal ]; + propagatedBuildInputs = [ + dateparser + humanize + pendulum + pytz + snaptime + tzlocal + ]; - # No tests - doCheck = false; + nativeCheckInputs = [ + freezegun + pytestCheckHook + ]; meta = with lib; { description = "Datetimes for Humans";