From 1dfb8fb7a9c7e14cb2de923c0a79a7acafe8598e Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 1 Nov 2022 11:21:41 +0100 Subject: [PATCH] python310Packages.python-lsp-server: switch to optional-dependencies --- .../python-lsp-server/default.nix | 96 ++++++++++++------- 1 file changed, 60 insertions(+), 36 deletions(-) diff --git a/pkgs/development/python-modules/python-lsp-server/default.nix b/pkgs/development/python-modules/python-lsp-server/default.nix index eafad1a9ab09..c72543343d19 100644 --- a/pkgs/development/python-modules/python-lsp-server/default.nix +++ b/pkgs/development/python-modules/python-lsp-server/default.nix @@ -1,4 +1,5 @@ { lib +, stdenv , autopep8 , buildPythonPackage , fetchFromGitHub @@ -21,19 +22,10 @@ , rope , setuptools , setuptools-scm -, stdenv , ujson +, websockets , whatthepatch , yapf -, withAutopep8 ? true -, withFlake8 ? true -, withMccabe ? true -, withPycodestyle ? true -, withPydocstyle ? true -, withPyflakes ? true -, withPylint ? true -, withRope ? true -, withYapf ? true }: buildPythonPackage rec { @@ -68,15 +60,53 @@ buildPythonPackage rec { setuptools setuptools-scm ujson - ] ++ lib.optional withAutopep8 autopep8 - ++ lib.optional withFlake8 flake8 - ++ lib.optional withMccabe mccabe - ++ lib.optional withPycodestyle pycodestyle - ++ lib.optional withPydocstyle pydocstyle - ++ lib.optional withPyflakes pyflakes - ++ lib.optional withPylint pylint - ++ lib.optional withRope rope - ++ lib.optionals withYapf [ whatthepatch yapf ]; + ]; + + passthru.optional-dependencies = { + all = [ + autopep8 + flake8 + mccabe + pycodestyle + pydocstyle + pyflakes + pylint + rope + whatthepatch + yapf + ]; + autopep8 = [ + autopep8 + ]; + flake8 = [ + flake8 + ]; + mccabe = [ + mccabe + ]; + pycodestyle = [ + pycodestyle + ]; + pydocstyle = [ + pydocstyle + ]; + pyflakes = [ + pyflakes + ]; + pylint = [ + pylint + ]; + rope = [ + rope + ]; + yapf = [ + whatthepatch + yapf + ]; + websockets = [ + websockets + ]; + }; checkInputs = [ flaky @@ -84,26 +114,20 @@ buildPythonPackage rec { numpy pandas pytestCheckHook - ] + ] ++ passthru.optional-dependencies.all # pyqt5 is broken on aarch64-darwin - ++ lib.optionals (!stdenv.isDarwin || !stdenv.isAarch64) [ pyqt5 ]; + ++ lib.optionals (!stdenv.isDarwin || !stdenv.isAarch64) [ + pyqt5 + ]; disabledTests = [ - "test_numpy_completions" # https://github.com/python-lsp/python-lsp-server/issues/243 - ] ++ lib.optional (!withPycodestyle) "test_workspace_loads_pycodestyle_config" - # pyqt5 is broken on aarch64-darwin - ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) "test_pyqt_completion"; - - disabledTestPaths = lib.optional (!withAutopep8) "test/plugins/test_autopep8_format.py" - ++ lib.optional (!withRope) "test/plugins/test_completion.py" - ++ lib.optional (!withFlake8) "test/plugins/test_flake8_lint.py" - ++ lib.optional (!withMccabe) "test/plugins/test_mccabe_lint.py" - ++ lib.optional (!withPycodestyle) "test/plugins/test_pycodestyle_lint.py" - ++ lib.optional (!withPydocstyle) "test/plugins/test_pydocstyle_lint.py" - ++ lib.optional (!withPyflakes) "test/plugins/test_pyflakes_lint.py" - ++ lib.optional (!withPylint) "test/plugins/test_pylint_lint.py" - ++ lib.optional (!withRope) "test/plugins/test_rope_rename.py" - ++ lib.optional (!withYapf) "test/plugins/test_yapf_format.py"; + # https://github.com/python-lsp/python-lsp-server/issues/243 + "test_numpy_completions" + "test_workspace_loads_pycodestyle_config" + ] ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) [ + # pyqt5 is broken on aarch64-darwin + "test_pyqt_completion" + ]; preCheck = '' export HOME=$(mktemp -d);