Fix cached builds

Copy files when installing, not move them (don't break cache).
This commit is contained in:
mpeterv 2015-12-05 21:49:06 +03:00
parent f799ad3b14
commit 62f94dab1b

View File

@ -133,24 +133,13 @@ def url_to_name(s):
def identifiers_to_string(identifiers): def identifiers_to_string(identifiers):
return "-".join(identifiers) return "-".join(identifiers)
def check_subdir(path, subdir): def copy_files(path, *files):
path = os.path.join(path, subdir)
if not os.path.exists(path): if not os.path.exists(path):
os.mkdir(path) os.makedirs(path)
return path
def move_files(path, *files):
for src in files: for src in files:
if src is not None: if src is not None:
dst = os.path.join(path, os.path.basename(src)) shutil.copy(src, path)
# On Windows os.rename will fail if destination exists.
if os.path.exists(dst):
os.remove(dst)
os.rename(src, dst)
class Program(object): class Program(object):
def __init__(self, version): def __init__(self, version):
@ -482,13 +471,14 @@ class RioLua(Lua):
self.arch_file = "liblua5" + self.major_version[2] + ".a" self.arch_file = "liblua5" + self.major_version[2] + ".a"
self.dll_file = "lua5" + self.major_version[2] + ".dll" self.dll_file = "lua5" + self.major_version[2] + ".dll"
def make(self): @staticmethod
self.set_files() def make():
run_command("make", opts.target) run_command("make", opts.target)
def make_install(self): def make_install(self):
self.set_files()
os.chdir("src") os.chdir("src")
move_files(check_subdir(opts.location, "bin"), copy_files(os.path.join(opts.location, "bin"),
self.lua_file, self.luac_file, self.dll_file) self.lua_file, self.luac_file, self.dll_file)
lua_hpp = "lua.hpp" lua_hpp = "lua.hpp"
@ -496,9 +486,9 @@ class RioLua(Lua):
if not os.path.exists(lua_hpp): if not os.path.exists(lua_hpp):
lua_hpp = "../etc/lua.hpp" lua_hpp = "../etc/lua.hpp"
move_files(check_subdir(opts.location, "include"), copy_files(os.path.join(opts.location, "include"),
"lua.h", "luaconf.h", "lualib.h", "lauxlib.h", lua_hpp) "lua.h", "luaconf.h", "lualib.h", "lauxlib.h", lua_hpp)
move_files(check_subdir(opts.location, "lib"), self.arch_file) copy_files(os.path.join(opts.location, "lib"), self.arch_file)
class LuaJIT(Lua): class LuaJIT(Lua):
name = "LuaJIT" name = "LuaJIT"