From a6e1747d00c07ab1895b44b0ca2f8c39b1a3b20e Mon Sep 17 00:00:00 2001
From: Thibaut Marty <github@thibautmarty.fr>
Date: Fri, 17 Dec 2021 10:55:47 +0100
Subject: [PATCH] grammalecte: 0.6.5 -> 2.1.1

---
 .../python-modules/grammalecte/default.nix     | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/pkgs/development/python-modules/grammalecte/default.nix b/pkgs/development/python-modules/grammalecte/default.nix
index c6fcca9434d2..9aa3c4ffd031 100644
--- a/pkgs/development/python-modules/grammalecte/default.nix
+++ b/pkgs/development/python-modules/grammalecte/default.nix
@@ -7,23 +7,29 @@
 
 buildPythonPackage rec {
   pname = "grammalecte";
-  version = "0.6.5";
+  version = "2.1.1";
 
   src = fetchurl {
-    url = "http://www.dicollecte.org/grammalecte/zip/Grammalecte-fr-v${version}.zip";
-    sha256 = "11byjs3ggdhia5f4vyfqfvbbczsfqimll98h98g7hlsrm7vrifb0";
+    url = "https://grammalecte.net/grammalecte/zip/Grammalecte-fr-v${version}.zip";
+    sha256 = "076jv3ywdgqqzg92bfbagc7ypy08xjq5zn4vgna6j9350fkfqhzn";
   };
 
+  patchPhase = ''
+    runHook prePatch
+    substituteInPlace grammalecte-server.py --replace sys.version_info.major sys.version_info
+    runHook postPatch
+  '';
+
   propagatedBuildInputs = [ bottle ];
 
-  preBuild = "cd ..";
+  sourceRoot = ".";
 
   disabled = !isPy3k;
 
   meta = {
-    description = "Grammalecte is an open source grammar checker for the French language";
+    description = "An open source grammar and typographic corrector for the French language";
     homepage = "https://grammalecte.net";
-    license = with lib.licenses; [ gpl3 ];
+    license = lib.licenses.gpl3Only;
     maintainers = with lib.maintainers; [ apeyroux ];
   };
 }