From 143d9931cd0cabe92e1370b344cb02c406e0b0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Althviz=20Mor=C3=A9?= Date: Mon, 2 Dec 2019 12:13:57 -0500 Subject: [PATCH] Remove ujson dependency on Windows (requires MSVC compiler) (#704) --- pyls/__main__.py | 5 ++++- pyls/plugins/pylint_lint.py | 6 +++++- setup.py | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pyls/__main__.py b/pyls/__main__.py index 00442f74..6440085f 100644 --- a/pyls/__main__.py +++ b/pyls/__main__.py @@ -4,7 +4,10 @@ import logging.config import sys -import ujson as json +try: + import ujson as json +except Exception: # pylint: disable=broad-except + import json from .python_ls import (PythonLanguageServer, start_io_lang_server, start_tcp_lang_server) diff --git a/pyls/plugins/pylint_lint.py b/pyls/plugins/pylint_lint.py index 52322e7a..9a412637 100644 --- a/pyls/plugins/pylint_lint.py +++ b/pyls/plugins/pylint_lint.py @@ -4,10 +4,14 @@ import logging import sys -import ujson as json from pylint.epylint import py_run from pyls import hookimpl, lsp +try: + import ujson as json +except Exception: # pylint: disable=broad-except + import json + log = logging.getLogger(__name__) diff --git a/setup.py b/setup.py index 73e86e46..a56416a0 100755 --- a/setup.py +++ b/setup.py @@ -36,9 +36,9 @@ 'future>=0.14.0; python_version<"3"', 'backports.functools_lru_cache; python_version<"3.2"', 'jedi>=0.14.1,<0.16', - 'python-jsonrpc-server>=0.3.0', + 'python-jsonrpc-server>=0.3.2', 'pluggy', - 'ujson<=1.35' + 'ujson<=1.35; platform_system!="Windows"' ], # List additional groups of dependencies here (e.g. development