diff options
| author | Peter Melnichenko <mpeterval@gmail.com> | 2016-10-14 23:45:15 +0300 |
|---|---|---|
| committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-10-14 23:53:34 +0300 |
| commit | 23043499b9a5423ecbc19e968142df17dc5d15d1 (patch) | |
| tree | 6d7cccaf57194ee2e5054013b2c440732d6819ed | |
| parent | 5610025dfdda1f58d9ee201ef2b32e63bd612c6d (diff) | |
| download | luarocks-23043499b9a5423ecbc19e968142df17dc5d15d1.tar.gz luarocks-23043499b9a5423ecbc19e968142df17dc5d15d1.tar.bz2 luarocks-23043499b9a5423ecbc19e968142df17dc5d15d1.zip | |
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.
| -rwxr-xr-x | configure | 4 | ||||
| -rw-r--r-- | install.bat | 2 | ||||
| -rw-r--r-- | src/luarocks/cfg.lua | 2 |
3 files changed, 4 insertions, 4 deletions
| @@ -226,8 +226,8 @@ then | |||
| 226 | fi | 226 | fi |
| 227 | 227 | ||
| 228 | detect_lua_version() { | 228 | detect_lua_version() { |
| 229 | detected_lua=`$1 -e 'print(_VERSION:sub(5))' 2> /dev/null` | 229 | detected_lua=`$1 -e 'print(_VERSION:match(" (5%.[123])$"))' 2> /dev/null` |
| 230 | if [ "$detected_lua" = "5.1" -o "$detected_lua" = "5.2" -o "$detected_lua" = "5.3" ] | 230 | if [ "$detected_lua" != "nil" ] |
| 231 | then | 231 | then |
| 232 | echo "Lua version detected: $detected_lua" | 232 | echo "Lua version detected: $detected_lua" |
| 233 | if [ "$LUA_VERSION_SET" != "yes" ] | 233 | 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) | |||
| 262 | local full_version = handler:read("*a") | 262 | local full_version = handler:read("*a") |
| 263 | handler:close() | 263 | handler:close() |
| 264 | 264 | ||
| 265 | local version = full_version:match("^Lua (5%.[123])$") | 265 | local version = full_version:match(" (5%.[123])$") |
| 266 | if not version then | 266 | if not version then |
| 267 | return nil, "unknown interpreter version '" .. full_version .. "'" | 267 | return nil, "unknown interpreter version '" .. full_version .. "'" |
| 268 | end | 268 | 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 | |||
| 18 | 18 | ||
| 19 | local util = require("luarocks.util") | 19 | local util = require("luarocks.util") |
| 20 | 20 | ||
| 21 | cfg.lua_version = _VERSION:sub(5) | 21 | cfg.lua_version = _VERSION:match(" (5%.[123])$") or "5.1" |
| 22 | local version_suffix = cfg.lua_version:gsub("%.", "_") | 22 | local version_suffix = cfg.lua_version:gsub("%.", "_") |
| 23 | 23 | ||
| 24 | -- Load site-local global configurations | 24 | -- Load site-local global configurations |
