Skip to content

Commit

Permalink
Relax Lua version detection to support Ravi
Browse files Browse the repository at this point in the history
Ravi has "Ravi 5.3" as _VERSION. Don't use _VERSION:sub(5) to get Lua
version, match " (5%.[123])$" instead.
  • Loading branch information
mpeterv committed Oct 14, 2016
1 parent 5610025 commit 2304349
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ then
fi

detect_lua_version() {
detected_lua=`$1 -e 'print(_VERSION:sub(5))' 2> /dev/null`
if [ "$detected_lua" = "5.1" -o "$detected_lua" = "5.2" -o "$detected_lua" = "5.3" ]
detected_lua=`$1 -e 'print(_VERSION:match(" (5%.[123])$"))' 2> /dev/null`
if [ "$detected_lua" != "nil" ]
then
echo "Lua version detected: $detected_lua"
if [ "$LUA_VERSION_SET" != "yes" ]
Expand Down
2 changes: 1 addition & 1 deletion install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ local function detect_lua_version(interpreter_path)
local full_version = handler:read("*a")
handler:close()

local version = full_version:match("^Lua (5%.[123])$")
local version = full_version:match(" (5%.[123])$")
if not version then
return nil, "unknown interpreter version '" .. full_version .. "'"
end
Expand Down
2 changes: 1 addition & 1 deletion src/luarocks/cfg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package.loaded["luarocks.cfg"] = cfg

local util = require("luarocks.util")

cfg.lua_version = _VERSION:sub(5)
cfg.lua_version = _VERSION:match(" (5%.[123])$") or "5.1"
local version_suffix = cfg.lua_version:gsub("%.", "_")

-- Load site-local global configurations
Expand Down

0 comments on commit 2304349

Please sign in to comment.