Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neovim, neovimUtils, neovim-qt: drop python2 support #121339

Merged
merged 1 commit into from
May 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nixos/doc/manual/release-notes/rl-2105.xml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
</listitem>
<listitem>
<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>
</listitem>
<listitem>
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/editors/neovim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/editors/neovim/neovim-qt.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib, mkDerivation, fetchFromGitHub, cmake, doxygen, makeWrapper
, msgpack, neovim, pythonPackages, qtbase }:
, msgpack, neovim, python3Packages, qtbase }:

mkDerivation rec {
pname = "neovim-qt-unwrapped";
Expand All @@ -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
]);

Expand Down
23 changes: 19 additions & 4 deletions pkgs/applications/editors/neovim/neovim-remote.nix
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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/";
Expand Down
3 changes: 1 addition & 2 deletions pkgs/applications/editors/neovim/qt.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{ lib, stdenv, mkDerivation, fetchFromGitHub, cmake, doxygen, makeWrapper
, msgpack, neovim, pythonPackages, qtbase, neovim-qt-unwrapped }:
{ stdenv, makeWrapper, neovim, neovim-qt-unwrapped }:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by cleanup of inputs, not used since 3a25004.


let
unwrapped = neovim-qt-unwrapped;
Expand Down
17 changes: 5 additions & 12 deletions pkgs/applications/editors/neovim/utils.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
, neovim-unwrapped
, bundlerEnv
, ruby
, pythonPackages
, python3Packages
, writeText
, wrapNeovimUnstable
Expand Down Expand Up @@ -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 ]
Expand All @@ -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;
};
Expand Down Expand Up @@ -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 {
Expand All @@ -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 */
Expand All @@ -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 != {}) [
Expand Down
8 changes: 3 additions & 5 deletions pkgs/applications/editors/neovim/wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
, bundlerEnv, ruby
, nodejs
, nodePackages
, pythonPackages
, python3Packages
}:
with lib;
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
''
Expand Down
2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26625,7 +26625,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;
Expand Down