From 23043499b9a5423ecbc19e968142df17dc5d15d1 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Fri, 14 Oct 2016 23:45:15 +0300 Subject: Relax Lua version detection to support Ravi Ravi has "Ravi 5.3" as _VERSION. Don't use _VERSION:sub(5) to get Lua version, match " (5%.[123])$" instead. --- configure | 4 ++-- install.bat | 2 +- src/luarocks/cfg.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 665d52bc..3636aed3 100755 --- a/configure +++ b/configure @@ -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" ] diff --git a/install.bat b/install.bat index cfa080e5..0a35a28a 100644 --- a/install.bat +++ b/install.bat @@ -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 diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index bcb30342..33176161 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -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 -- cgit v1.2.3-55-g6feb