aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/installers/pip3.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/nvim-lsp-installer/installers/pip3.lua')
-rw-r--r--lua/nvim-lsp-installer/installers/pip3.lua26
1 files changed, 17 insertions, 9 deletions
diff --git a/lua/nvim-lsp-installer/installers/pip3.lua b/lua/nvim-lsp-installer/installers/pip3.lua
index 277e0321..cb0af84b 100644
--- a/lua/nvim-lsp-installer/installers/pip3.lua
+++ b/lua/nvim-lsp-installer/installers/pip3.lua
@@ -1,4 +1,6 @@
local path = require "nvim-lsp-installer.path"
+local installers = require "nvim-lsp-installer.installers"
+local std = require "nvim-lsp-installer.installers.std"
local platform = require "nvim-lsp-installer.platform"
local process = require "nvim-lsp-installer.process"
@@ -7,17 +9,23 @@ local M = {}
local REL_INSTALL_DIR = "venv"
function M.packages(packages)
- return function(server, callback, context)
- local c = process.chain {
- cwd = server.root_dir,
- stdio_sink = context.stdio_sink,
- }
+ return installers.pipe {
+ std.ensure_executables {
+ { "python3", "python3 was not found in path. Refer to https://www.python.org/downloads/." },
+ { "pip3", "pip3 was not found in path." },
+ },
+ function(server, callback, context)
+ local c = process.chain {
+ cwd = server.root_dir,
+ stdio_sink = context.stdio_sink,
+ }
- c.run("python3", { "-m", "venv", REL_INSTALL_DIR })
- c.run(M.executable(server.root_dir, "pip3"), vim.list_extend({ "install", "-U" }, packages))
+ c.run("python3", { "-m", "venv", REL_INSTALL_DIR })
+ c.run(M.executable(server.root_dir, "pip3"), vim.list_extend({ "install", "-U" }, packages))
- c.spawn(callback)
- end
+ c.spawn(callback)
+ end,
+ }
end
function M.executable(root_dir, executable)