Skip to content
Open
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
4 changes: 4 additions & 0 deletions lua/mason-core/installer/managers/pypi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local pep440 = require "mason-core.pep440"
local platform = require "mason-core.platform"
local providers = require "mason-core.providers"
local semver = require "mason-core.semver"
local settings = require "mason.settings"
local spawn = require "mason-core.spawn"

local M = {}
Expand Down Expand Up @@ -85,6 +86,9 @@ local function create_venv(pkg)

-- 1. Resolve stock python3 installation.
local stock_candidates = platform.is.win and { "python", "python3" } or { "python3", "python" }
if settings.current.pip.use_python3_host_prog and vim.g.python3_host_prog then
table.insert(stock_candidates, 1, vim.g.python3_host_prog)
end
local stock_target = resolve_python3(stock_candidates)
if stock_target then
log.fmt_debug("Resolved stock python3 installation version %s", stock_target.version)
Expand Down
3 changes: 3 additions & 0 deletions lua/mason/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ local function check_languages()
check_thunk { cmd = "julia", args = { "--version" }, name = "julia", relaxed = true },
function()
local python = platform.is.win and "python" or "python3"
if settings.current.pip.use_python3_host_prog and vim.g.python3_host_prog then
python = vim.g.python3_host_prog
end
check { cmd = python, args = { "--version" }, name = "python", relaxed = true }
check { cmd = python, args = { "-m", "pip", "--version" }, name = "pip", relaxed = true }
check {
Expand Down
4 changes: 4 additions & 0 deletions lua/mason/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ local DEFAULT_SETTINGS = {
--
-- Example: { "--proxy", "https://proxyserver" }
install_args = {},

---@since 2.0.1
-- Respect the `vim.g.python3_host_prog` while resolving packages from PyPI
use_python3_host_prog = false,
},

ui = {
Expand Down