aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-05-30 01:50:37 +0200
committerGitHub <noreply@github.com>2022-05-30 01:50:37 +0200
commit1c85bf298ac2eb71bb72e6a932abbea370f1d6d8 (patch)
treea041490139630bfcf934d81ac93a96981e13d645 /lua/nvim-lsp-installer
parentrefactor(async): log errors that occur inside a.scope blocks (#735) (diff)
downloadmason-1c85bf298ac2eb71bb72e6a932abbea370f1d6d8.tar
mason-1c85bf298ac2eb71bb72e6a932abbea370f1d6d8.tar.gz
mason-1c85bf298ac2eb71bb72e6a932abbea370f1d6d8.tar.bz2
mason-1c85bf298ac2eb71bb72e6a932abbea370f1d6d8.tar.lz
mason-1c85bf298ac2eb71bb72e6a932abbea370f1d6d8.tar.xz
mason-1c85bf298ac2eb71bb72e6a932abbea370f1d6d8.tar.zst
mason-1c85bf298ac2eb71bb72e6a932abbea370f1d6d8.zip
refactor(pip3): use with_paths to set venv path (#736)
Diffstat (limited to 'lua/nvim-lsp-installer')
-rw-r--r--lua/nvim-lsp-installer/core/managers/pip3/init.lua9
-rw-r--r--lua/nvim-lsp-installer/core/spawn.lua2
2 files changed, 4 insertions, 7 deletions
diff --git a/lua/nvim-lsp-installer/core/managers/pip3/init.lua b/lua/nvim-lsp-installer/core/managers/pip3/init.lua
index 0c442243..3b617745 100644
--- a/lua/nvim-lsp-installer/core/managers/pip3/init.lua
+++ b/lua/nvim-lsp-installer/core/managers/pip3/init.lua
@@ -61,8 +61,7 @@ function M.install(packages)
"-U",
settings.current.pip.install_args,
pkgs,
- env = M.env(ctx.cwd:get()), -- use venv env
- check_executable = false,
+ with_paths = { M.venv_path(ctx.cwd:get()) },
}
end)
:or_else_throw "Unable to create python3 venv environment."
@@ -95,8 +94,7 @@ function M.check_outdated_primary_package(receipt, install_dir)
"--outdated",
"--format=json",
cwd = install_dir,
- env = M.env(install_dir), -- use venv
- check_executable = false,
+ with_paths = { M.venv_path(install_dir) },
}):map_catching(function(result)
---@alias PipOutdatedPackage {name: string, version: string, latest_version: string}
---@type PipOutdatedPackage[]
@@ -132,8 +130,7 @@ function M.get_installed_primary_package_version(receipt, install_dir)
"list",
"--format=json",
cwd = install_dir,
- env = M.env(install_dir), -- use venv env
- check_executable = false,
+ with_paths = { M.venv_path(install_dir) },
}):map_catching(function(result)
local pip_packages = vim.json.decode(result.stdout)
local normalized_pip_package = M.normalize_package(receipt.primary_source.package)
diff --git a/lua/nvim-lsp-installer/core/spawn.lua b/lua/nvim-lsp-installer/core/spawn.lua
index 812848c3..17e2563f 100644
--- a/lua/nvim-lsp-installer/core/spawn.lua
+++ b/lua/nvim-lsp-installer/core/spawn.lua
@@ -87,7 +87,7 @@ setmetatable(spawn, {
local cmd = self._aliases[normalized_cmd] or normalized_cmd
- if args.with_paths == nil and args.check_executable ~= false and not is_executable(cmd) then
+ if (env and env.PATH) == nil and args.check_executable ~= false and not is_executable(cmd) then
return Failure({
stderr = ("%s is not executable"):format(cmd),
}, cmd)