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.
This commit is contained in:
Martin Weinelt 2021-05-01 02:29:59 +02:00 committed by Matthieu Coudron
parent f5e695bf3a
commit d942d4473d
8 changed files with 34 additions and 29 deletions

View File

@ -330,7 +330,7 @@
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
<literal>vim</literal> switched to Python 3, dropping all Python 2 support. <literal>vim</literal> and <literal>neovim</literal> switched to Python 3, dropping all Python 2 support.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>

View File

@ -6,7 +6,7 @@
# now defaults to false because some tests can be flaky (clipboard etc) # now defaults to false because some tests can be flaky (clipboard etc)
, doCheck ? false , doCheck ? false
, nodejs ? null, fish ? null, python ? null , nodejs ? null, fish ? null, python3 ? null
}: }:
with lib; 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. # FIXME: this is verry messy and strange.
# see https://github.com/NixOS/nixpkgs/pull/80528 # see https://github.com/NixOS/nixpkgs/pull/80528

View File

@ -1,5 +1,5 @@
{ lib, mkDerivation, fetchFromGitHub, cmake, doxygen, makeWrapper { lib, mkDerivation, fetchFromGitHub, cmake, doxygen, makeWrapper
, msgpack, neovim, pythonPackages, qtbase }: , msgpack, neovim, python3Packages, qtbase }:
mkDerivation rec { mkDerivation rec {
pname = "neovim-qt-unwrapped"; pname = "neovim-qt-unwrapped";
@ -20,7 +20,7 @@ mkDerivation rec {
buildInputs = [ buildInputs = [
neovim.unwrapped # only used to generate help tags at build time neovim.unwrapped # only used to generate help tags at build time
qtbase qtbase
] ++ (with pythonPackages; [ ] ++ (with python3Packages; [
jinja2 python msgpack jinja2 python msgpack
]); ]);

View File

@ -1,11 +1,14 @@
{ lib, fetchFromGitHub, pythonPackages }: { lib
, fetchFromGitHub
, python3
, neovim
}:
with lib; with lib;
pythonPackages.buildPythonApplication rec { with python3.pkgs; buildPythonApplication rec {
pname = "neovim-remote"; pname = "neovim-remote";
version = "2.4.0"; version = "2.4.0";
disabled = !pythonPackages.isPy3k;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "mhinz"; owner = "mhinz";
@ -14,12 +17,24 @@ pythonPackages.buildPythonApplication rec {
sha256 = "0jlw0qksak4bdzddpsj74pm2f2bgpj3cwrlspdjjy0j9qzg0mpl9"; sha256 = "0jlw0qksak4bdzddpsj74pm2f2bgpj3cwrlspdjjy0j9qzg0mpl9";
}; };
propagatedBuildInputs = with pythonPackages; [ propagatedBuildInputs = [
pynvim pynvim
psutil psutil
setuptools 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 = { meta = {
description = "A tool that helps controlling nvim processes from a terminal"; description = "A tool that helps controlling nvim processes from a terminal";
homepage = "https://github.com/mhinz/neovim-remote/"; homepage = "https://github.com/mhinz/neovim-remote/";

View File

@ -1,5 +1,4 @@
{ lib, stdenv, mkDerivation, fetchFromGitHub, cmake, doxygen, makeWrapper { stdenv, makeWrapper, neovim, neovim-qt-unwrapped }:
, msgpack, neovim, pythonPackages, qtbase, neovim-qt-unwrapped }:
let let
unwrapped = neovim-qt-unwrapped; unwrapped = neovim-qt-unwrapped;

View File

@ -4,7 +4,6 @@
, neovim-unwrapped , neovim-unwrapped
, bundlerEnv , bundlerEnv
, ruby , ruby
, pythonPackages
, python3Packages , python3Packages
, writeText , writeText
, wrapNeovimUnstable , wrapNeovimUnstable
@ -48,12 +47,6 @@ let
requiredPlugins = vimUtils.requiredPlugins configure; requiredPlugins = vimUtils.requiredPlugins configure;
getDeps = attrname: map (plugin: plugin.${attrname} or (_: [ ])); 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; pluginPython3Packages = getDeps "python3Dependencies" requiredPlugins;
python3Env = python3Packages.python.withPackages (ps: python3Env = python3Packages.python.withPackages (ps:
[ ps.pynvim ] [ ps.pynvim ]
@ -69,7 +62,6 @@ let
# While the latter tells nvim that this provider is not available # While the latter tells nvim that this provider is not available
hostprog_check_table = { hostprog_check_table = {
node = withNodeJs; node = withNodeJs;
python = withPython2;
python3 = withPython3; python3 = withPython3;
ruby = withRuby; ruby = withRuby;
}; };
@ -99,11 +91,12 @@ let
manifestRc = vimUtils.vimrcContent (configure // { customRC = ""; }); manifestRc = vimUtils.vimrcContent (configure // { customRC = ""; });
neovimRcContent = vimUtils.vimrcContent configure; neovimRcContent = vimUtils.vimrcContent configure;
in in
assert withPython2 -> throw "Python2 support has been removed from neovim, please remove withPython2 and extraPython2Packages.";
args // { args // {
wrapperArgs = makeWrapperArgs; wrapperArgs = makeWrapperArgs;
inherit neovimRcContent; inherit neovimRcContent;
inherit manifestRc; inherit manifestRc;
inherit python2Env;
inherit python3Env; inherit python3Env;
inherit withNodeJs; inherit withNodeJs;
} // lib.optionalAttrs withRuby { } // lib.optionalAttrs withRuby {
@ -120,7 +113,7 @@ let
# to keep backwards compatibility # to keep backwards compatibility
legacyWrapper = neovim: { legacyWrapper = neovim: {
extraMakeWrapperArgs ? "" extraMakeWrapperArgs ? ""
, withPython ? true , withPython ? false
/* the function you would have passed to python.withPackages */ /* the function you would have passed to python.withPackages */
, extraPythonPackages ? (_: []) , extraPythonPackages ? (_: [])
/* the function you would have passed to python.withPackages */ /* the function you would have passed to python.withPackages */
@ -138,14 +131,14 @@ let
else funOrList); else funOrList);
res = makeNeovimConfig { res = makeNeovimConfig {
withPython2 = withPython;
extraPythonPackages = compatFun extraPythonPackages;
inherit withPython3; inherit withPython3;
extraPython3Packages = compatFun extraPython3Packages; extraPython3Packages = compatFun extraPython3Packages;
inherit withNodeJs withRuby viAlias vimAlias; inherit withNodeJs withRuby viAlias vimAlias;
inherit configure; inherit configure;
}; };
in in
assert withPython -> throw "Python2 support has been removed from neovim, please remove withPython and extraPythonPackages.";
wrapNeovimUnstable neovim (res // { wrapNeovimUnstable neovim (res // {
wrapperArgs = lib.escapeShellArgs ( wrapperArgs = lib.escapeShellArgs (
res.wrapperArgs ++ lib.optionals (configure != {}) [ res.wrapperArgs ++ lib.optionals (configure != {}) [

View File

@ -3,7 +3,6 @@
, bundlerEnv, ruby , bundlerEnv, ruby
, nodejs , nodejs
, nodePackages , nodePackages
, pythonPackages
, python3Packages , python3Packages
}: }:
with lib; with lib;
@ -15,7 +14,7 @@ let
# should contain all args but the binary # should contain all args but the binary
wrapperArgs ? "" wrapperArgs ? ""
, manifestRc ? null , manifestRc ? null
, withPython2 ? true, python2Env ? null , withPython2 ? false
, withPython3 ? true, python3Env ? null , withPython3 ? true, python3Env ? null
, withNodeJs ? false , withNodeJs ? false
, rubyEnv ? null , rubyEnv ? null
@ -35,6 +34,8 @@ let
[ "${neovim}/bin/nvim" "${placeholder "out"}/bin/nvim" ] ++ [ "${neovim}/bin/nvim" "${placeholder "out"}/bin/nvim" ] ++
[ "--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim" ]; [ "--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim" ];
in in
assert withPython2 -> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env.";
symlinkJoin { symlinkJoin {
name = "neovim-${lib.getVersion neovim}"; name = "neovim-${lib.getVersion neovim}";
# Remove the symlinks created by symlinkJoin which we need to perform # 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 \ substitute ${neovim}/share/applications/nvim.desktop $out/share/applications/nvim.desktop \
--replace 'Name=Neovim' 'Name=WrappedNeovim' --replace 'Name=Neovim' 'Name=WrappedNeovim'
'' ''
+ optionalString withPython2 ''
makeWrapper ${python2Env}/bin/python $out/bin/nvim-python --unset PYTHONPATH
''
+ optionalString withPython3 '' + optionalString withPython3 ''
makeWrapper ${python3Env}/bin/python3 $out/bin/nvim-python3 --unset PYTHONPATH makeWrapper ${python3Env}/bin/python3 $out/bin/nvim-python3 --unset PYTHONPATH
'' ''

View File

@ -26626,7 +26626,7 @@ in
gnvim = callPackage ../applications/editors/neovim/gnvim/wrapper.nix { }; 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 { vis = callPackage ../applications/editors/vis {
inherit (lua52Packages) lpeg; inherit (lua52Packages) lpeg;