aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-08-02 18:35:40 +0200
committerGitHub <noreply@github.com>2022-08-02 18:35:40 +0200
commit546d81893bd3d8c3c817bd9c3ec26a0760215500 (patch)
treeaeb2f603424ecb2e282ac10d9288d60b49a0febf /lua
parentchore: update issue templates (#230) (diff)
downloadmason-546d81893bd3d8c3c817bd9c3ec26a0760215500.tar
mason-546d81893bd3d8c3c817bd9c3ec26a0760215500.tar.gz
mason-546d81893bd3d8c3c817bd9c3ec26a0760215500.tar.bz2
mason-546d81893bd3d8c3c817bd9c3ec26a0760215500.tar.lz
mason-546d81893bd3d8c3c817bd9c3ec26a0760215500.tar.xz
mason-546d81893bd3d8c3c817bd9c3ec26a0760215500.tar.zst
mason-546d81893bd3d8c3c817bd9c3ec26a0760215500.zip
feat(debugpy): write executable for convenient access (#229)
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-core/installer/context.lua15
-rw-r--r--lua/mason-registry/debugpy/init.lua8
2 files changed, 22 insertions, 1 deletions
diff --git a/lua/mason-core/installer/context.lua b/lua/mason-core/installer/context.lua
index 93d45a8a..89226f94 100644
--- a/lua/mason-core/installer/context.lua
+++ b/lua/mason-core/installer/context.lua
@@ -213,6 +213,21 @@ function InstallContext:write_node_exec_wrapper(new_executable_rel_path, script_
end
---@param new_executable_rel_path string: Relative path to the executable file to create.
+---@param module string: The python module to call.
+function InstallContext:write_pyvenv_exec_wrapper(new_executable_rel_path, module)
+ return self:write_shell_exec_wrapper(
+ new_executable_rel_path,
+ ("%q -m %s"):format(
+ path.concat {
+ require("mason-core.managers.pip3").venv_path(self.package:get_install_path()),
+ "python",
+ },
+ module
+ )
+ )
+end
+
+---@param new_executable_rel_path string: Relative path to the executable file to create.
---@param target_executable_rel_path string
function InstallContext:write_exec_wrapper(new_executable_rel_path, target_executable_rel_path)
return self:write_shell_exec_wrapper(
diff --git a/lua/mason-registry/debugpy/init.lua b/lua/mason-registry/debugpy/init.lua
index fefe7bfc..38f46911 100644
--- a/lua/mason-registry/debugpy/init.lua
+++ b/lua/mason-registry/debugpy/init.lua
@@ -1,5 +1,6 @@
local Pkg = require "mason-core.package"
local pip3 = require "mason-core.managers.pip3"
+local path = require "mason-core.path"
return Pkg.new {
name = "debugpy",
@@ -7,5 +8,10 @@ return Pkg.new {
homepage = "https://github.com/microsoft/debugpy",
languages = { Pkg.Lang.Python },
categories = { Pkg.Cat.DAP },
- install = pip3.packages { "debugpy" },
+ ---@async
+ ---@param ctx InstallContext
+ install = function(ctx)
+ pip3.install({ "debugpy" }).with_receipt()
+ ctx:link_bin("debugpy", ctx:write_pyvenv_exec_wrapper("debugpy", "debugpy"))
+ end,
}