From da4f4e183c1dde9c8481d4719df2c518ea9fa34a Mon Sep 17 00:00:00 2001
From: Fabian Affolter <mail@fabian-affolter.ch>
Date: Tue, 28 Jun 2022 18:51:16 +0200
Subject: [PATCH] python310Packages.klein: 21.8.0 -> unstable-2022-06-26

---
 .../python-modules/klein/default.nix          | 59 +++++++++++++++----
 1 file changed, 47 insertions(+), 12 deletions(-)

diff --git a/pkgs/development/python-modules/klein/default.nix b/pkgs/development/python-modules/klein/default.nix
index 33e6171737ff..84f69812cc29 100644
--- a/pkgs/development/python-modules/klein/default.nix
+++ b/pkgs/development/python-modules/klein/default.nix
@@ -1,30 +1,65 @@
-{ stdenv, lib, buildPythonPackage, fetchPypi, python
-, attrs, enum34, hyperlink, incremental, six, twisted, typing, tubes, werkzeug, zope_interface
-, hypothesis, treq
+{ lib
+, stdenv
+, attrs
+, buildPythonPackage
+, fetchFromGitHub
+, hyperlink
+, hypothesis
+, incremental
+, python
+, pythonOlder
+, treq
+, tubes
+, twisted
+, typing-extensions
+, werkzeug
+, zope_interface
 }:
 
 buildPythonPackage rec {
   pname = "klein";
-  version = "21.8.0";
+  version = "unstable-2022-06-26";
+  format = "setuptools";
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "1mpydmz90d0n9dwa7mr6pgj5v0kczfs05ykssrasdq368dssw7ch";
+  disabled = pythonOlder "3.7";
+
+  src = fetchFromGitHub {
+    owner = "twisted";
+    repo = pname;
+    rev = "d8c2b92a3c77aa64c596696fb6f07172ecf94a74";
+    hash = "sha256-RDZqavkteUbARV78OctZtLIrE4RoYDVAanjwE5i/ZeM=";
   };
 
-  propagatedBuildInputs = [ attrs enum34 hyperlink incremental six twisted typing tubes werkzeug zope_interface ];
+  propagatedBuildInputs = [
+    attrs
+    hyperlink
+    incremental
+    twisted
+    tubes
+    werkzeug
+    zope_interface
+  ] ++ lib.optionals (pythonOlder "3.8") [
+    typing-extensions
+  ];
 
-  checkInputs = [ hypothesis treq ];
+  checkInputs = [
+    hypothesis
+    treq
+  ];
 
   checkPhase = ''
     ${python.interpreter} -m twisted.trial -j $NIX_BUILD_CORES klein
   '';
 
+  pythonImportsCheck = [
+    "klein"
+  ];
+
   meta = with lib; {
-    broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin;
     description = "Klein Web Micro-Framework";
-    homepage    = "https://github.com/twisted/klein";
-    license     = licenses.mit;
+    homepage = "https://github.com/twisted/klein";
+    license = licenses.mit;
     maintainers = with maintainers; [ exarkun ];
+    broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin;
   };
 }