From d942d4473d1165cf9d8a1171bbad154f77239ba0 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sat, 1 May 2021 02:29:59 +0200 Subject: [PATCH] neovim, neovimUtils, neovim-qt: drop python2 support In 2a00e53bd pynvim support for python2 was disabled, this broke the neovim build. I really think it is time to let go of python2 support in neovim. --- nixos/doc/manual/release-notes/rl-2105.xml | 2 +- pkgs/applications/editors/neovim/default.nix | 4 ++-- .../applications/editors/neovim/neovim-qt.nix | 4 ++-- .../editors/neovim/neovim-remote.nix | 23 +++++++++++++++---- pkgs/applications/editors/neovim/qt.nix | 3 +-- pkgs/applications/editors/neovim/utils.nix | 17 ++++---------- pkgs/applications/editors/neovim/wrapper.nix | 8 +++---- pkgs/top-level/all-packages.nix | 2 +- 8 files changed, 34 insertions(+), 29 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2105.xml b/nixos/doc/manual/release-notes/rl-2105.xml index b45c19fa9af9..0fe0b28cd91e 100644 --- a/nixos/doc/manual/release-notes/rl-2105.xml +++ b/nixos/doc/manual/release-notes/rl-2105.xml @@ -330,7 +330,7 @@ - vim switched to Python 3, dropping all Python 2 support. + vim and neovim switched to Python 3, dropping all Python 2 support. diff --git a/pkgs/applications/editors/neovim/default.nix b/pkgs/applications/editors/neovim/default.nix index 3e5de3d5fc15..1b4835064f96 100644 --- a/pkgs/applications/editors/neovim/default.nix +++ b/pkgs/applications/editors/neovim/default.nix @@ -6,7 +6,7 @@ # now defaults to false because some tests can be flaky (clipboard etc) , doCheck ? false -, nodejs ? null, fish ? null, python ? null +, nodejs ? null, fish ? null, python3 ? null }: with lib; @@ -19,7 +19,7 @@ let ] )); - pyEnv = python.withPackages(ps: [ ps.pynvim ps.msgpack ]); + pyEnv = python3.withPackages(ps: with ps; [ pynvim msgpack ]); # FIXME: this is verry messy and strange. # see https://github.com/NixOS/nixpkgs/pull/80528 diff --git a/pkgs/applications/editors/neovim/neovim-qt.nix b/pkgs/applications/editors/neovim/neovim-qt.nix index d925ddd2a528..0a4d17d997b5 100644 --- a/pkgs/applications/editors/neovim/neovim-qt.nix +++ b/pkgs/applications/editors/neovim/neovim-qt.nix @@ -1,5 +1,5 @@ { lib, mkDerivation, fetchFromGitHub, cmake, doxygen, makeWrapper -, msgpack, neovim, pythonPackages, qtbase }: +, msgpack, neovim, python3Packages, qtbase }: mkDerivation rec { pname = "neovim-qt-unwrapped"; @@ -20,7 +20,7 @@ mkDerivation rec { buildInputs = [ neovim.unwrapped # only used to generate help tags at build time qtbase - ] ++ (with pythonPackages; [ + ] ++ (with python3Packages; [ jinja2 python msgpack ]); diff --git a/pkgs/applications/editors/neovim/neovim-remote.nix b/pkgs/applications/editors/neovim/neovim-remote.nix index 867e22751284..2b1281ae21be 100644 --- a/pkgs/applications/editors/neovim/neovim-remote.nix +++ b/pkgs/applications/editors/neovim/neovim-remote.nix @@ -1,11 +1,14 @@ -{ lib, fetchFromGitHub, pythonPackages }: +{ lib +, fetchFromGitHub +, python3 +, neovim +}: with lib; -pythonPackages.buildPythonApplication rec { +with python3.pkgs; buildPythonApplication rec { pname = "neovim-remote"; version = "2.4.0"; - disabled = !pythonPackages.isPy3k; src = fetchFromGitHub { owner = "mhinz"; @@ -14,12 +17,24 @@ pythonPackages.buildPythonApplication rec { sha256 = "0jlw0qksak4bdzddpsj74pm2f2bgpj3cwrlspdjjy0j9qzg0mpl9"; }; - propagatedBuildInputs = with pythonPackages; [ + propagatedBuildInputs = [ pynvim psutil setuptools ]; + checkInputs = [ + neovim + pytestCheckHook + ]; + + disabledTests = [ + # these tests get stuck and never return + "test_escape_filenames_properly" + "test_escape_single_quotes_in_filenames" + "test_escape_double_quotes_in_filenames" + ]; + meta = { description = "A tool that helps controlling nvim processes from a terminal"; homepage = "https://github.com/mhinz/neovim-remote/"; diff --git a/pkgs/applications/editors/neovim/qt.nix b/pkgs/applications/editors/neovim/qt.nix index 5210b6b67c8b..1da7e7e966e3 100644 --- a/pkgs/applications/editors/neovim/qt.nix +++ b/pkgs/applications/editors/neovim/qt.nix @@ -1,5 +1,4 @@ -{ lib, stdenv, mkDerivation, fetchFromGitHub, cmake, doxygen, makeWrapper -, msgpack, neovim, pythonPackages, qtbase, neovim-qt-unwrapped }: +{ stdenv, makeWrapper, neovim, neovim-qt-unwrapped }: let unwrapped = neovim-qt-unwrapped; diff --git a/pkgs/applications/editors/neovim/utils.nix b/pkgs/applications/editors/neovim/utils.nix index d992ccd3f6a4..6d04fa6851a6 100644 --- a/pkgs/applications/editors/neovim/utils.nix +++ b/pkgs/applications/editors/neovim/utils.nix @@ -4,7 +4,6 @@ , neovim-unwrapped , bundlerEnv , ruby -, pythonPackages , python3Packages , writeText , wrapNeovimUnstable @@ -48,12 +47,6 @@ let requiredPlugins = vimUtils.requiredPlugins configure; getDeps = attrname: map (plugin: plugin.${attrname} or (_: [ ])); - pluginPython2Packages = getDeps "pythonDependencies" requiredPlugins; - python2Env = pythonPackages.python.withPackages (ps: - [ ps.pynvim ] - ++ (extraPython2Packages ps) - ++ (lib.concatMap (f: f ps) pluginPython2Packages)); - pluginPython3Packages = getDeps "python3Dependencies" requiredPlugins; python3Env = python3Packages.python.withPackages (ps: [ ps.pynvim ] @@ -69,7 +62,6 @@ let # While the latter tells nvim that this provider is not available hostprog_check_table = { node = withNodeJs; - python = withPython2; python3 = withPython3; ruby = withRuby; }; @@ -99,11 +91,12 @@ let manifestRc = vimUtils.vimrcContent (configure // { customRC = ""; }); neovimRcContent = vimUtils.vimrcContent configure; in + assert withPython2 -> throw "Python2 support has been removed from neovim, please remove withPython2 and extraPython2Packages."; + args // { wrapperArgs = makeWrapperArgs; inherit neovimRcContent; inherit manifestRc; - inherit python2Env; inherit python3Env; inherit withNodeJs; } // lib.optionalAttrs withRuby { @@ -120,7 +113,7 @@ let # to keep backwards compatibility legacyWrapper = neovim: { extraMakeWrapperArgs ? "" - , withPython ? true + , withPython ? false /* the function you would have passed to python.withPackages */ , extraPythonPackages ? (_: []) /* the function you would have passed to python.withPackages */ @@ -138,14 +131,14 @@ let else funOrList); res = makeNeovimConfig { - withPython2 = withPython; - extraPythonPackages = compatFun extraPythonPackages; inherit withPython3; extraPython3Packages = compatFun extraPython3Packages; inherit withNodeJs withRuby viAlias vimAlias; inherit configure; }; in + assert withPython -> throw "Python2 support has been removed from neovim, please remove withPython and extraPythonPackages."; + wrapNeovimUnstable neovim (res // { wrapperArgs = lib.escapeShellArgs ( res.wrapperArgs ++ lib.optionals (configure != {}) [ diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix index 66127980bf67..db30832d2398 100644 --- a/pkgs/applications/editors/neovim/wrapper.nix +++ b/pkgs/applications/editors/neovim/wrapper.nix @@ -3,7 +3,6 @@ , bundlerEnv, ruby , nodejs , nodePackages -, pythonPackages , python3Packages }: with lib; @@ -15,7 +14,7 @@ let # should contain all args but the binary wrapperArgs ? "" , manifestRc ? null - , withPython2 ? true, python2Env ? null + , withPython2 ? false , withPython3 ? true, python3Env ? null , withNodeJs ? false , rubyEnv ? null @@ -35,6 +34,8 @@ let [ "${neovim}/bin/nvim" "${placeholder "out"}/bin/nvim" ] ++ [ "--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim" ]; in + assert withPython2 -> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env."; + symlinkJoin { name = "neovim-${lib.getVersion neovim}"; # Remove the symlinks created by symlinkJoin which we need to perform @@ -44,9 +45,6 @@ let substitute ${neovim}/share/applications/nvim.desktop $out/share/applications/nvim.desktop \ --replace 'Name=Neovim' 'Name=WrappedNeovim' '' - + optionalString withPython2 '' - makeWrapper ${python2Env}/bin/python $out/bin/nvim-python --unset PYTHONPATH - '' + optionalString withPython3 '' makeWrapper ${python3Env}/bin/python3 $out/bin/nvim-python3 --unset PYTHONPATH '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 61b5050bc95a..029495618b09 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26626,7 +26626,7 @@ in gnvim = callPackage ../applications/editors/neovim/gnvim/wrapper.nix { }; - neovim-remote = callPackage ../applications/editors/neovim/neovim-remote.nix { pythonPackages = python3Packages; }; + neovim-remote = callPackage ../applications/editors/neovim/neovim-remote.nix { }; vis = callPackage ../applications/editors/vis { inherit (lua52Packages) lpeg;