aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-10-06 12:46:14 +0200
committerGitHub <noreply@github.com>2022-10-06 12:46:14 +0200
commite93a299b1e4972be382bf6c9451df237a26fafce (patch)
treec98f5606fd32bf12b5d908ee57e3e39d72f8c635 /lua
parentchore: update generated code (#518) (diff)
downloadmason-e93a299b1e4972be382bf6c9451df237a26fafce.tar
mason-e93a299b1e4972be382bf6c9451df237a26fafce.tar.gz
mason-e93a299b1e4972be382bf6c9451df237a26fafce.tar.bz2
mason-e93a299b1e4972be382bf6c9451df237a26fafce.tar.lz
mason-e93a299b1e4972be382bf6c9451df237a26fafce.tar.xz
mason-e93a299b1e4972be382bf6c9451df237a26fafce.tar.zst
mason-e93a299b1e4972be382bf6c9451df237a26fafce.zip
fix(pip3): expand python3_host_prog path (#519)
Fixes #505.
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-core/managers/pip3/init.lua10
-rw-r--r--lua/mason/health/init.lua7
2 files changed, 14 insertions, 3 deletions
diff --git a/lua/mason-core/managers/pip3/init.lua b/lua/mason-core/managers/pip3/init.lua
index ace0b7db..4581bc0b 100644
--- a/lua/mason-core/managers/pip3/init.lua
+++ b/lua/mason-core/managers/pip3/init.lua
@@ -1,4 +1,5 @@
local _ = require "mason-core.functional"
+local a = require "mason-core.async"
local settings = require "mason.settings"
local path = require "mason-core.path"
local platform = require "mason-core.platform"
@@ -44,8 +45,13 @@ function M.install(packages)
pkgs[1] = ("%s==%s"):format(pkgs[1], version)
end)
- local executables = platform.is.win and _.list_not_nil(vim.g.python3_host_prog, "python", "python3")
- or _.list_not_nil(vim.g.python3_host_prog, "python3", "python")
+ if vim.in_fast_event() then
+ a.scheduler()
+ end
+
+ local executables = platform.is.win
+ and _.list_not_nil(vim.g.python3_host_prog and vim.fn.expand(vim.g.python3_host_prog), "python", "python3")
+ or _.list_not_nil(vim.g.python3_host_prog and vim.fn.expand(vim.g.python3_host_prog), "python3", "python")
-- pip3 will hardcode the full path to venv executables, so we need to promote cwd to make sure pip uses the final destination path.
ctx:promote_cwd()
diff --git a/lua/mason/health/init.lua b/lua/mason/health/init.lua
index 342015f1..727bae32 100644
--- a/lua/mason/health/init.lua
+++ b/lua/mason/health/init.lua
@@ -242,7 +242,12 @@ function M.check()
if vim.g.python3_host_prog then
table.insert(
checks,
- check { cmd = vim.g.python3_host_prog, args = { "--version" }, name = "python3_host_prog", relaxed = true }
+ check {
+ cmd = vim.fn.expand(vim.g.python3_host_prog),
+ args = { "--version" },
+ name = "python3_host_prog",
+ relaxed = true,
+ }
)
end