about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFabian Affolter <mail@fabian-affolter.ch>2023-01-21 16:24:30 +0100
committerRobert Schütz <nix@dotlambda.de>2023-01-21 17:25:04 -0800
commit460e16d242243dbfb843af2b0a1825e559b392b1 (patch)
tree8655daa5c03d120dbffc0a89410beb3a40fdbd1f
parentd972df3b1a41cf96d2f8f31aa8682bc9bd7a1908 (diff)
python310Packages.cached-property: fix build for Python 3.11
-rw-r--r--pkgs/development/python-modules/cached-property/default.nix42
1 files changed, 33 insertions, 9 deletions
diff --git a/pkgs/development/python-modules/cached-property/default.nix b/pkgs/development/python-modules/cached-property/default.nix
index 90cfc63b76265..555b1ce006e7e 100644
--- a/pkgs/development/python-modules/cached-property/default.nix
+++ b/pkgs/development/python-modules/cached-property/default.nix
@@ -1,31 +1,55 @@
 { lib
 , buildPythonPackage
-, fetchPypi
+, fetchFromGitHub
+, fetchpatch
 , pytestCheckHook
 , freezegun
+, pythonOlder
 }:
 
 buildPythonPackage rec {
   pname = "cached-property";
   version = "1.5.2";
+  format = "setuptools";
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "9fa5755838eecbb2d234c3aa390bd80fbd3ac6b6869109bfc1b499f7bd89a130";
+  disabled = pythonOlder "3.7";
+
+  src = fetchFromGitHub {
+    owner = "pydanny";
+    repo = pname;
+    rev = "refs/tags/${version}";
+    hash = "sha256-DGI8FaEjFd2bDeBDKcA0zDCE+5I6meapVNZgycE1gzs=";
   };
 
-  nativeCheckInputs = [ pytestCheckHook freezegun ];
+  patches = [
+    # Don't use asyncio.coroutine if it's not available, https://github.com/pydanny/cached-property/pull/267
+    (fetchpatch {
+      name = "asyncio-coroutine.patch";
+      url = "https://github.com/pydanny/cached-property/commit/297031687679762849dedeaf24aa3a19116f095b.patch";
+      hash = "sha256-qolrUdaX7db4hE125Lt9ICmPNYsD/uBmQrdO4q5NG3c=";
+    })
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+    freezegun
+  ];
 
   disabledTests = [
     # https://github.com/pydanny/cached-property/issues/131
     "test_threads_ttl_expiry"
   ];
 
-  meta = {
+  pythonImportsCheck = [
+    "cached_property"
+  ];
+
+  meta = with lib; {
     description = "A decorator for caching properties in classes";
     homepage = "https://github.com/pydanny/cached-property";
-    license = lib.licenses.bsd3;
-    platforms = lib.platforms.unix;
-    maintainers = with lib.maintainers; [ ericsagnes ];
+    changelog = "https://github.com/pydanny/cached-property/releases/tag/${version}";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ ericsagnes ];
   };
 }