Fixes and updates for Ravi
This commit is contained in:
parent
0f7d5e186d
commit
04a19743ed
40
hererocks.py
40
hererocks.py
@ -13,7 +13,6 @@ import re
|
|||||||
import shutil
|
import shutil
|
||||||
import stat
|
import stat
|
||||||
import string
|
import string
|
||||||
import stat
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tarfile
|
import tarfile
|
||||||
@ -600,9 +599,8 @@ class Lua(Program):
|
|||||||
self.add_package_paths_redefines()
|
self.add_package_paths_redefines()
|
||||||
self.add_compat_cflags_and_redefines()
|
self.add_compat_cflags_and_redefines()
|
||||||
|
|
||||||
@staticmethod
|
def major_version_from_source(self):
|
||||||
def major_version_from_source():
|
with open(self.lua_h_path()) as lua_h:
|
||||||
with open(os.path.join("src", "lua.h")) as lua_h:
|
|
||||||
for line in lua_h:
|
for line in lua_h:
|
||||||
match = re.match(r"^\s*#define\s+LUA_VERSION_NUM\s+50(\d)\s*$", line)
|
match = re.match(r"^\s*#define\s+LUA_VERSION_NUM\s+50(\d)\s*$", line)
|
||||||
|
|
||||||
@ -687,6 +685,9 @@ class Lua(Program):
|
|||||||
def luaconf_h_path(self):
|
def luaconf_h_path(self):
|
||||||
return os.path.join("src", "luaconf.h")
|
return os.path.join("src", "luaconf.h")
|
||||||
|
|
||||||
|
def lua_h_path(self):
|
||||||
|
return os.path.join("src", "lua.h")
|
||||||
|
|
||||||
def patch_redefines(self):
|
def patch_redefines(self):
|
||||||
redefines = "\n".join(self.redefines)
|
redefines = "\n".join(self.redefines)
|
||||||
|
|
||||||
@ -1400,11 +1401,12 @@ class Ravi(Lua):
|
|||||||
title = "Ravi"
|
title = "Ravi"
|
||||||
downloads = "https://github.com/dibyendumajumdar/ravi/archive"
|
downloads = "https://github.com/dibyendumajumdar/ravi/archive"
|
||||||
win32_zip = False
|
win32_zip = False
|
||||||
default_repo = "https://github.com/dibyendumajumdar/ravi/archive"
|
default_repo = "https://github.com/dibyendumajumdar/ravi"
|
||||||
versions = [
|
versions = [
|
||||||
"0.15.1",
|
"0.15.1",
|
||||||
]
|
]
|
||||||
translations = {
|
translations = {
|
||||||
|
"0": "0.15.1",
|
||||||
"0.15": "0.15.1",
|
"0.15": "0.15.1",
|
||||||
"^": "0.15.1",
|
"^": "0.15.1",
|
||||||
"latest": "0.15.1"
|
"latest": "0.15.1"
|
||||||
@ -1413,15 +1415,15 @@ class Ravi(Lua):
|
|||||||
"ravi-0.15.1.tar.gz" : "c42b4540a37f763904895f7fb5757f0ce0e5185e7c3e5316eb056a1ac505134d",
|
"ravi-0.15.1.tar.gz" : "c42b4540a37f763904895f7fb5757f0ce0e5185e7c3e5316eb056a1ac505134d",
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, version):
|
|
||||||
super(Ravi, self).__init__(version)
|
|
||||||
|
|
||||||
def get_download_url(self):
|
def get_download_url(self):
|
||||||
return self.downloads + "/" + self.fixed_version + ".tar.gz"
|
return self.downloads + "/" + self.fixed_version + ".tar.gz"
|
||||||
|
|
||||||
def luaconf_h_path(self):
|
def luaconf_h_path(self):
|
||||||
return os.path.join("include", "luaconf.h")
|
return os.path.join("include", "luaconf.h")
|
||||||
|
|
||||||
|
def lua_h_path(self):
|
||||||
|
return os.path.join("include", "lua.h")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def major_version_from_version():
|
def major_version_from_version():
|
||||||
return "5.3"
|
return "5.3"
|
||||||
@ -1431,7 +1433,7 @@ class Ravi(Lua):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def set_compat(self):
|
def set_compat(self):
|
||||||
self.compat = "5.2"
|
self.compat = "default"
|
||||||
|
|
||||||
def add_compat_cflags_and_redefines(self):
|
def add_compat_cflags_and_redefines(self):
|
||||||
pass
|
pass
|
||||||
@ -1464,11 +1466,10 @@ class Ravi(Lua):
|
|||||||
with open(lua_file, "w") as lua_exe:
|
with open(lua_file, "w") as lua_exe:
|
||||||
lua_exe.write(
|
lua_exe.write(
|
||||||
"""#!/bin/sh
|
"""#!/bin/sh
|
||||||
export LD_LIBRARY_PATH="%(lib_dir)s:$LD_LIBRARY_PATH"
|
export LD_LIBRARY_PATH="{lib_dir}:$LD_LIBRARY_PATH"
|
||||||
exec "%(exe)s" "$@" """ % {
|
exec "{exe}" "$@\"""".format(
|
||||||
"lib_dir": os.path.join(opts.location, "lib"),
|
lib_dir=os.path.join(opts.location, "lib"),
|
||||||
"exe": os.path.join(opts.location, "bin", exe("ravi")),
|
exe=os.path.join(opts.location, "bin", exe("ravi")))
|
||||||
}
|
|
||||||
)
|
)
|
||||||
# chmod +x
|
# chmod +x
|
||||||
st = os.stat(lua_file)
|
st = os.stat(lua_file)
|
||||||
@ -1564,10 +1565,9 @@ class LuaRocks(Program):
|
|||||||
vs_short_version, vs_year, " Win64" if vs_arch == "x64" else "")
|
vs_short_version, vs_year, " Win64" if vs_arch == "x64" else "")
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
lua_identifiers = any(
|
lua_identifiers = self.all_identifiers.get("lua",
|
||||||
self.all_identifiers.get(name)
|
self.all_identifiers.get("LuaJIT",
|
||||||
for name in ["lua", "LuaJIT", "ravi"]
|
self.all_identifiers.get("ravi")))
|
||||||
)
|
|
||||||
|
|
||||||
if lua_identifiers is None:
|
if lua_identifiers is None:
|
||||||
sys.exit("Error: can't install LuaRocks: Lua is not present in {}".format(opts.location))
|
sys.exit("Error: can't install LuaRocks: Lua is not present in {}".format(opts.location))
|
||||||
@ -1989,7 +1989,9 @@ def main(argv=None):
|
|||||||
if "LuaJIT" in identifiers:
|
if "LuaJIT" in identifiers:
|
||||||
del identifiers["LuaJIT"]
|
del identifiers["LuaJIT"]
|
||||||
|
|
||||||
identifiers_changed = Ravi(opts.ravi).update_identifiers(identifiers)
|
if Ravi(opts.ravi).update_identifiers(identifiers):
|
||||||
|
save_installed_identifiers(identifiers)
|
||||||
|
|
||||||
os.chdir(start_dir)
|
os.chdir(start_dir)
|
||||||
|
|
||||||
if opts.luarocks:
|
if opts.luarocks:
|
||||||
|
|||||||
@ -99,14 +99,14 @@ class TestCLI(unittest.TestCase):
|
|||||||
self.assertHererocksSuccess([
|
self.assertHererocksSuccess([
|
||||||
"--luajit", "latest", "--compat", "5.2", "--cflags=-DLUA_USE_APICHECK", "--target", "vs"])
|
"--luajit", "latest", "--compat", "5.2", "--cflags=-DLUA_USE_APICHECK", "--target", "vs"])
|
||||||
|
|
||||||
def test_install_latest_luajit_with_latest_luarocks(self):
|
def test_install_latest_ravi_with_latest_luarocks(self):
|
||||||
self.assertHererocksSuccess(["--ravi", "latest", "--luarocks", "latest", "--verbose"])
|
self.assertHererocksSuccess(["--ravi", "latest", "--luarocks", "latest", "--verbose"])
|
||||||
self.assertSuccess(["lua", "-v"], ["Ravi 5.3.2"])
|
self.assertSuccess(["lua", "-v"], ["Ravi 5.3.2"])
|
||||||
self.assertSuccess(["lua", "-e", "local t: table = {}"])
|
self.assertSuccess(["lua", "-e", "local t: table = {}"])
|
||||||
|
|
||||||
self.assertSuccess(["luarocks", "--version"])
|
self.assertSuccess(["luarocks", "--version"])
|
||||||
self.assertSuccess(["luarocks", "make", os.path.join("test", "hererocks-test-scm-1.rockspec")])
|
self.assertSuccess(["luarocks", "make", os.path.join("test", "hererocks-test-scm-1.rockspec")])
|
||||||
self.assertSuccess(["hererocks-test"], ["Ravi 5.3.2"])
|
self.assertSuccess(["hererocks-test"], ["Ravi 5.3"])
|
||||||
|
|
||||||
self.assertHererocksSuccess(["--ravi", "latest", "--luarocks", "latest"], ["already installed"])
|
self.assertHererocksSuccess(["--ravi", "latest", "--luarocks", "latest"], ["already installed"])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user