diff options
Diffstat (limited to 'lua/nvim-lsp-installer/installers/pip3.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/installers/pip3.lua | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lua/nvim-lsp-installer/installers/pip3.lua b/lua/nvim-lsp-installer/installers/pip3.lua index 62996196..79fbb0f7 100644 --- a/lua/nvim-lsp-installer/installers/pip3.lua +++ b/lua/nvim-lsp-installer/installers/pip3.lua @@ -1,4 +1,5 @@ local path = require "nvim-lsp-installer.path" +local platform = require "nvim-lsp-installer.platform" local shell = require "nvim-lsp-installer.installers.shell" local M = {} @@ -6,13 +7,20 @@ local M = {} local REL_INSTALL_DIR = "venv" function M.packages(packages) - return shell.raw(("./%s/bin/pip3 install -U %s"):format(REL_INSTALL_DIR, table.concat(packages, " ")), { - prefix = ("set -euo pipefail; python3 -m venv %q;"):format(REL_INSTALL_DIR), - }) + local venv_activate_cmd = platform.is_win() and (".\\%s\\Scripts\\activate"):format(REL_INSTALL_DIR) + or ("source ./%s/bin/activate"):format(REL_INSTALL_DIR) + + return shell.polyshell( + ("python3 -m venv %q && %s && pip3 install -U %s"):format( + REL_INSTALL_DIR, + venv_activate_cmd, + table.concat(packages, " ") + ) + ) end function M.executable(root_dir, executable) - return path.concat { root_dir, REL_INSTALL_DIR, "bin", executable } + return path.concat { root_dir, REL_INSTALL_DIR, platform.is_win() and "Scripts" or "bin", executable } end return M |
