diff options
| author | William Boman <william@redwill.se> | 2023-06-18 17:34:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-18 17:34:03 +0200 |
| commit | 6f3853e5ae8c200e29d2e394e479d9c3f8e018f5 (patch) | |
| tree | d0ff165030ae675fb03707cc155b6e787daaae9a /lua | |
| parent | refactor(installer): hoist version validation to the compiled installation en... (diff) | |
| download | mason-6f3853e5ae8c200e29d2e394e479d9c3f8e018f5.tar mason-6f3853e5ae8c200e29d2e394e479d9c3f8e018f5.tar.gz mason-6f3853e5ae8c200e29d2e394e479d9c3f8e018f5.tar.bz2 mason-6f3853e5ae8c200e29d2e394e479d9c3f8e018f5.tar.lz mason-6f3853e5ae8c200e29d2e394e479d9c3f8e018f5.tar.xz mason-6f3853e5ae8c200e29d2e394e479d9c3f8e018f5.tar.zst mason-6f3853e5ae8c200e29d2e394e479d9c3f8e018f5.zip | |
feat(health): add advice for Debian/Ubuntu regarding python3 venv (#1358)
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/mason/health.lua | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lua/mason/health.lua b/lua/mason/health.lua index a2182988..fdd5ea07 100644 --- a/lua/mason/health.lua +++ b/lua/mason/health.lua @@ -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") @@ -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 @@ -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() |
