about summary refs log tree commit diff
path: root/pkgs/development/python-modules/python-lsp-black/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/python-lsp-black/default.nix')
-rw-r--r--pkgs/development/python-modules/python-lsp-black/default.nix56
1 files changed, 27 insertions, 29 deletions
diff --git a/pkgs/development/python-modules/python-lsp-black/default.nix b/pkgs/development/python-modules/python-lsp-black/default.nix
index 6387e833b7fcd..efa83fe40d54c 100644
--- a/pkgs/development/python-modules/python-lsp-black/default.nix
+++ b/pkgs/development/python-modules/python-lsp-black/default.nix
@@ -1,13 +1,14 @@
-{ lib
-, pythonOlder
-, buildPythonPackage
-, fetchFromGitHub
-, pytestCheckHook
-, black
-, python-lsp-server
-, setuptools
-, tomli
-, fetchpatch
+{
+  lib,
+  pythonOlder,
+  buildPythonPackage,
+  fetchFromGitHub,
+  pytestCheckHook,
+  black,
+  python-lsp-server,
+  setuptools,
+  tomli,
+  fetchpatch,
 }:
 
 buildPythonPackage rec {
@@ -24,32 +25,29 @@ buildPythonPackage rec {
   };
 
   patches =
-    /** fix test failure with black<24.2.0;
-        remove this patch once python-lsp-black>2.0.0 */
-    lib.optional
-      (with lib; (versionOlder version "2.0.1") && (versionAtLeast black.version "24.2.0"))
-      (fetchpatch {
-        url = "https://patch-diff.githubusercontent.com/raw/python-lsp/python-lsp-black/pull/56.patch";
-        hash = "sha256-38bYU27+xtA8Kq3appXTkNnkG5/XgrUJ2nQ5+yuSU2U=";
-      })
-    ++ [ ];
-
-  nativeBuildInputs = [
-    setuptools
-  ];
+    /**
+      includes a series of patches fixing tests not yet released as 2.0.1+ version
+       they are meant to keep up to date with black releases
+    */
+    lib.optional (with lib; versionAtLeast black.version "24.2.0") (fetchpatch {
+      url = "https://github.com/python-lsp/python-lsp-black/commit/d43b41431379f9c9bb05fab158c4d97e6d515f8f.patch";
+      hash = "sha256-38bYU27+xtA8Kq3appXTkNnkG5/XgrUJ2nQ5+yuSU2U=";
+    })
+    ++ lib.optional (with lib; versionAtLeast black.version "24.3.0") (fetchpatch {
+      url = "https://github.com/python-lsp/python-lsp-black/commit/9298585a9d14d25920c33b188d79e820dc98d4a9.patch";
+      hash = "sha256-4u0VIS7eidVEiKRW2wc8lJVkJwhzJD/M+uuqmTtiZ7E=";
+    });
+
+  nativeBuildInputs = [ setuptools ];
 
   nativeCheckInputs = [ pytestCheckHook ];
 
   propagatedBuildInputs = [
     black
     python-lsp-server
-  ] ++ lib.optionals (pythonOlder "3.11") [
-    tomli
-  ];
+  ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
 
-  pythonImportsCheck = [
-    "pylsp_black"
-  ];
+  pythonImportsCheck = [ "pylsp_black" ];
 
   meta = with lib; {
     homepage = "https://github.com/python-lsp/python-lsp-black";