From 24a855097a7632e967852b1cbb70bb4b392acc2f Mon Sep 17 00:00:00 2001
From: Fabian Affolter <mail@fabian-affolter.ch>
Date: Fri, 24 Sep 2021 01:03:30 +0200
Subject: [PATCH] python3Packages.hiyapyco: allow later Jinja2 releases

---
 .../python-modules/hiyapyco/default.nix       | 20 +++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/pkgs/development/python-modules/hiyapyco/default.nix b/pkgs/development/python-modules/hiyapyco/default.nix
index f443c58723e8..79693747cfac 100644
--- a/pkgs/development/python-modules/hiyapyco/default.nix
+++ b/pkgs/development/python-modules/hiyapyco/default.nix
@@ -6,7 +6,7 @@
 }:
 
 buildPythonPackage rec {
-  pname = "HiYaPyCo";
+  pname = "hiyapyco";
   version = "0.4.16";
 
   src = fetchFromGitHub {
@@ -16,17 +16,29 @@ buildPythonPackage rec {
     sha256 = "1ams9dp05yhgbg6255wrjgchl2mqg0s34d8b8prvql9lsh59s1fj";
   };
 
-  propagatedBuildInputs = [ pyyaml jinja2 ];
+  propagatedBuildInputs = [
+    pyyaml
+    jinja2
+  ];
+
+  postPatch = ''
+    # Should no longer be needed with the next release
+    # https://github.com/zerwes/hiyapyco/pull/42
+    substituteInPlace setup.py \
+      --replace "Jinja2>1,<3" "Jinja2>1"
+  '';
 
   checkPhase = ''
     set -e
     find test -name 'test_*.py' -exec python {} \;
   '';
 
+  pythonImportsCheck = [ "hiyapyco" ];
+
   meta = with lib; {
-    description = "A simple python lib allowing hierarchical overlay of config files in YAML syntax, offering different merge methods and variable interpolation based on jinja2.";
+    description = "Python library allowing hierarchical overlay of config files in YAML syntax";
     homepage = "https://github.com/zerwes/hiyapyco";
-    license = licenses.gpl3;
+    license = licenses.gpl3Plus;
     maintainers = with maintainers; [ veehaitch ];
   };
 }