Skip to content

Commit

Permalink
feat(health): add advice for Debian/Ubuntu regarding python3 venv (#1358
Browse files Browse the repository at this point in the history
)
  • Loading branch information
williamboman authored Jun 18, 2023
1 parent ed98935 commit 6f3853e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions lua/mason/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ local report_error = _.scheduler_wrap(health.error or health.report_error)
local sem = Semaphore.new(5)

---@async
---@param opts {cmd:string, args:string[], name: string, use_stderr: boolean?, version_check: (fun(version: string): string?), relaxed: boolean?}
---@param opts {cmd:string, args:string[], name: string, use_stderr: boolean?, version_check: (fun(version: string): string?), relaxed: boolean?, advice: string[]}
local function check(opts)
local get_first_non_empty_line = _.compose(_.head, _.filter(_.complement(_.matches "^%s*$")), _.split "\n")

Expand Down Expand Up @@ -60,7 +60,7 @@ local function check(opts)
report_ok(("%s: `%s`"):format(opts.name, version or "Ok"))
end):on_failure(function(err)
local report = opts.relaxed and report_warn or report_error
report(("%s: not available"):format(opts.name), { tostring(err) })
report(("%s: not available"):format(opts.name), opts.advice or { tostring(err) })
end)
permit:forget()
end
Expand Down Expand Up @@ -249,13 +249,20 @@ local function check_languages()
check_thunk { cmd = "java", args = { "-version" }, name = "java", use_stderr = true, relaxed = true },
check_thunk { cmd = "julia", args = { "--version" }, name = "julia", relaxed = true },
function()
if platform.is.win then
check { cmd = "python", args = { "--version" }, name = "python", relaxed = true }
check { cmd = "python", args = { "-m", "pip", "--version" }, name = "pip", relaxed = true }
else
check { cmd = "python3", args = { "--version" }, name = "python3", relaxed = true }
check { cmd = "python3", args = { "-m", "pip", "--version" }, name = "pip3", relaxed = true }
end
local python = platform.is.win and "python" or "python3"
check { cmd = python, args = { "--version" }, name = "python", relaxed = true }
check { cmd = python, args = { "-m", "pip", "--version" }, name = "pip", relaxed = true }
check {
cmd = python,
args = { "-c", "import venv" },
name = "python venv",
relaxed = true,
advice = {
[[On Debian/Ubuntu systems, you need to install the python3-venv package using the following command:
apt-get install python3-venv]],
},
}
end,
function()
a.scheduler()
Expand Down

0 comments on commit 6f3853e

Please # to comment.