gnu: python-pyls-black: Fix build.
* gnu/packages/patches/python-pyls-black-41.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/python-xyz.scm (python-pyls-black)[source]: Add patch. [build-system]: Use pyproject-build-system. [arguments]: Disable one failing test. Change-Id: I14b2982644e58c0b43d76838febc6dfceb220b15master
parent
8520f00d69
commit
b8085c9240
|
@ -1796,6 +1796,7 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/python-random2-getrandbits-test.patch \
|
%D%/packages/patches/python-random2-getrandbits-test.patch \
|
||||||
%D%/packages/patches/python-poppler-qt5-fix-build.patch \
|
%D%/packages/patches/python-poppler-qt5-fix-build.patch \
|
||||||
%D%/packages/patches/python-pyreadstat-link-libiconv.patch \
|
%D%/packages/patches/python-pyreadstat-link-libiconv.patch \
|
||||||
|
%D%/packages/patches/python-pyls-black-41.patch \
|
||||||
%D%/packages/patches/python-pypdf-annotate-tests-appropriately.patch \
|
%D%/packages/patches/python-pypdf-annotate-tests-appropriately.patch \
|
||||||
%D%/packages/patches/python-pytorch2-system-libraries.patch \
|
%D%/packages/patches/python-pytorch2-system-libraries.patch \
|
||||||
%D%/packages/patches/python-sip-include-dirs.patch \
|
%D%/packages/patches/python-sip-include-dirs.patch \
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
From ada6a999e4f5cca21a2133e449f4576dbe9a64d2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Isaac Dadzie <4581114+idadzie@users.noreply.github.com>
|
||||||
|
Date: Fri, 4 Feb 2022 21:18:37 +0000
|
||||||
|
Subject: [PATCH] Add support for black 22.1.0
|
||||||
|
|
||||||
|
Make changes to support black 22.1.0, which changed the return type
|
||||||
|
of 'find_project_root' to a tuple.
|
||||||
|
|
||||||
|
Resolves: #40
|
||||||
|
---
|
||||||
|
pyls_black/plugin.py | 8 +++++++-
|
||||||
|
setup.cfg | 2 +-
|
||||||
|
2 files changed, 8 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pyls_black/plugin.py b/pyls_black/plugin.py
|
||||||
|
index dc5d482..e4f4d98 100644
|
||||||
|
--- a/pyls_black/plugin.py
|
||||||
|
+++ b/pyls_black/plugin.py
|
||||||
|
@@ -73,7 +73,13 @@ def load_config(filename: str) -> Dict:
|
||||||
|
|
||||||
|
root = black.find_project_root((filename,))
|
||||||
|
|
||||||
|
- pyproject_filename = root / "pyproject.toml"
|
||||||
|
+ # Note: find_project_root returns a tuple in 22.1.0+
|
||||||
|
+ try:
|
||||||
|
+ # Keeping this to not break backward compatibility.
|
||||||
|
+ pyproject_filename = root / "pyproject.toml"
|
||||||
|
+ except TypeError:
|
||||||
|
+ _root, _ = root
|
||||||
|
+ pyproject_filename = _root / "pyproject.toml"
|
||||||
|
|
||||||
|
if not pyproject_filename.is_file():
|
||||||
|
return defaults
|
||||||
|
diff --git a/setup.cfg b/setup.cfg
|
||||||
|
index 036cec2..57fbe4f 100644
|
||||||
|
--- a/setup.cfg
|
||||||
|
+++ b/setup.cfg
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
[metadata]
|
||||||
|
name = pyls-black
|
||||||
|
-version = 0.4.7
|
||||||
|
+version = 0.4.8
|
||||||
|
author = Rupert Bedford
|
||||||
|
author_email = rupert@rupertb.com
|
||||||
|
description = Black plugin for the Python Language Server
|
|
@ -2666,6 +2666,7 @@ Unicode-to-LaTeX conversion.")
|
||||||
(file-name (git-file-name name version))
|
(file-name (git-file-name name version))
|
||||||
(sha256
|
(sha256
|
||||||
(base32 "0bkhfnlik89j3yamr20br4wm8975f20v33wabi2nyxvj10whr5dj"))
|
(base32 "0bkhfnlik89j3yamr20br4wm8975f20v33wabi2nyxvj10whr5dj"))
|
||||||
|
(patches (search-patches "python-pyls-black-41.patch"))
|
||||||
;; Patch to work with python-lsp-server. Taken from
|
;; Patch to work with python-lsp-server. Taken from
|
||||||
;; <https://github.com/rupert/pyls-black/pull/37>.
|
;; <https://github.com/rupert/pyls-black/pull/37>.
|
||||||
(modules '((guix build utils)))
|
(modules '((guix build utils)))
|
||||||
|
@ -2681,9 +2682,11 @@ Unicode-to-LaTeX conversion.")
|
||||||
"pylsp_format_range")
|
"pylsp_format_range")
|
||||||
(("from pyls([ \\.])" _ char)
|
(("from pyls([ \\.])" _ char)
|
||||||
(string-append "from pylsp" char)))))))
|
(string-append "from pylsp" char)))))))
|
||||||
(build-system python-build-system)
|
(build-system pyproject-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:test-target "pytest"))
|
(list
|
||||||
|
#:test-flags
|
||||||
|
'(list "-k" "not test_load_config_target_version")))
|
||||||
(propagated-inputs
|
(propagated-inputs
|
||||||
(list python-black python-lsp-server python-tomli))
|
(list python-black python-lsp-server python-tomli))
|
||||||
(native-inputs
|
(native-inputs
|
||||||
|
|
Reference in New Issue