From 02b9a76ed096e2f2a5e5903e44c26591f86c259e Mon Sep 17 00:00:00 2001 From: kevinhwang91 Date: Thu, 21 Apr 2022 00:24:20 +0800 Subject: [PATCH] fix(luarocks): compatible with PUC Lua --- doc/packer.txt | 3 --- lua/packer/luarocks.lua | 31 ++++++------------------------- vim.toml | 3 --- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/doc/packer.txt b/doc/packer.txt index 354bd77a..b055ef0e 100644 --- a/doc/packer.txt +++ b/doc/packer.txt @@ -22,9 +22,6 @@ REQUIREMENTS *packer-intro-requirements* - You need to be running Neovim v0.5.0+; `packer` makes use of extmarks and other newly-added Neovim features. -- Your version of Neovim must be compiled with LuaJIT support; `packer` relies - on this to detect whether you are running Windows or a Unix-like OS (for path - separators) - If you are on Windows 10, you need developer mode enabled in order to use local plugins (creating symbolic links requires admin privileges on Windows - credit to @TimUntersberger for this note) diff --git a/lua/packer/luarocks.lua b/lua/packer/luarocks.lua index 449e9f0c..1da89674 100644 --- a/lua/packer/luarocks.lua +++ b/lua/packer/luarocks.lua @@ -14,36 +14,17 @@ local config = nil local function cfg(_config) config = _config.luarocks end -local function warn_need_luajit() - log.error 'LuaJIT is required for Luarocks functionality!' -end -local lua_version = nil +local jit_version if jit then - local jit_version = string.gsub(jit.version, 'LuaJIT ', '') - lua_version = { lua = string.gsub(_VERSION, 'Lua ', ''), jit = jit_version, dir = jit_version } -else - return { - handle_command = warn_need_luajit, - install_commands = warn_need_luajit, - list = warn_need_luajit, - install_hererocks = warn_need_luajit, - setup_paths = warn_need_luajit, - uninstall = warn_need_luajit, - clean = warn_need_luajit, - install = warn_need_luajit, - ensure = warn_need_luajit, - generate_path_setup = function() - return '' - end, - cfg = cfg, - } + jit_version = string.gsub(jit.version, 'LuaJIT ', '') end +local lua_version = { lua = string.gsub(_VERSION, 'Lua ', ''), jit = jit_version } local cache_path = vim.fn.stdpath 'cache' local rocks_path = util.join_paths(cache_path, 'packer_hererocks') local hererocks_file = util.join_paths(rocks_path, 'hererocks.py') -local hererocks_install_dir = util.join_paths(rocks_path, lua_version.dir) +local hererocks_install_dir = util.join_paths(rocks_path, lua_version.jit or lua_version.lua) local shell_hererocks_dir = vim.fn.shellescape(hererocks_install_dir) local _hererocks_setup_done = false local function hererocks_is_setup() @@ -86,8 +67,8 @@ local function hererocks_installer(disp) local luarocks_cmd = config.python_cmd .. ' ' .. hererocks_file - .. ' --verbose -j ' - .. lua_version.jit + .. ' --verbose ' + .. (lua_version.jit and ('-j ' .. lua_version.jit) or ('-l ' .. lua_version.lua)) .. ' -r latest ' .. hererocks_install_dir r diff --git a/vim.toml b/vim.toml index 4206f6cf..576760a2 100644 --- a/vim.toml +++ b/vim.toml @@ -5,9 +5,6 @@ name = "vim" [vim] any = true -[jit] -any = true - [[describe.args]] type = "string" [[describe.args]]