From e1d60a05af55daadaeaf85d14869459b9b8c9635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Wed, 10 Mar 2021 15:11:41 +0100 Subject: [PATCH] pythonPackages.convertdate: add python2-compatible expression --- .../python-modules/convertdate/2.2.x.nix | 36 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 5 ++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/convertdate/2.2.x.nix diff --git a/pkgs/development/python-modules/convertdate/2.2.x.nix b/pkgs/development/python-modules/convertdate/2.2.x.nix new file mode 100644 index 000000000000..d67f4c5a3449 --- /dev/null +++ b/pkgs/development/python-modules/convertdate/2.2.x.nix @@ -0,0 +1,36 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pymeeus +, pytz +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "convertdate"; + version = "2.2.2"; + + # Tests are not available in the PyPI tarball so use GitHub instead. + src = fetchFromGitHub { + owner = "fitnr"; + repo = pname; + rev = "v${version}"; + sha256 = "1xgi7x9b9kxm0q51bqnmwdm5lp8vwhx5yk4d1b23r37spz9dbhw5"; + }; + + propagatedBuildInputs = [ + pymeeus + pytz + ]; + + checkInputs = [ + pytestCheckHook + ]; + + meta = with lib; { + homepage = "https://github.com/fitnr/convertdate"; + description = "Utils for converting between date formats and calculating holidays"; + license = licenses.mit; + maintainers = with maintainers; [ jluttine ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7799b6356b39..6237954eac36 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1472,7 +1472,10 @@ in { contextvars = callPackage ../development/python-modules/contextvars { }; - convertdate = callPackage ../development/python-modules/convertdate { }; + convertdate = if isPy27 then + callPackage ../development/python-modules/convertdate/2.2.x.nix { } + else + callPackage ../development/python-modules/convertdate { }; cookiecutter = callPackage ../development/python-modules/cookiecutter { };