mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-24 20:27:40 +00:00
Made scons hardlink binaries to working copy root instead of copying them.
This commit is contained in:
parent
89dbf2d5a3
commit
d5eea14d8b
@ -312,7 +312,8 @@ Import(binaries + ["sources"])
|
||||
binary_nodes = map(eval, binaries)
|
||||
if build == "release" : build_suffix = "" + env["PROGSUFFIX"]
|
||||
else : build_suffix = "-" + build + env["PROGSUFFIX"]
|
||||
map(lambda bin, node: Alias(bin, node, node and Copy("./" + bin + build_suffix, node[0].path)), binaries, binary_nodes)
|
||||
from install import HardLink
|
||||
map(lambda bin, node: Alias(bin, node, node and HardLink("./" + bin + build_suffix, node[0].path)), binaries, binary_nodes)
|
||||
binaries.remove("test")
|
||||
env.Alias("all", map(Alias, binaries))
|
||||
env.Default(map(Alias, env["default_targets"]))
|
||||
|
@ -49,6 +49,27 @@ def InstallWithSuffix(env, target, source):
|
||||
return source
|
||||
return env.InstallAs(os.path.join(target, source[0].name + env["program_suffix"]), source)
|
||||
|
||||
from SCons.Action import ActionFactory
|
||||
from shutil import copy2
|
||||
def hard_link(dest, src, symlink = False):
|
||||
try:
|
||||
if symlink:
|
||||
os.symlink(src, dest)
|
||||
else:
|
||||
os.link(src, dest)
|
||||
except OSError, e:
|
||||
if e.errno == 18:
|
||||
hard_link(dest, src, True)
|
||||
else:
|
||||
os.remove(dest)
|
||||
os.link(src, dest)
|
||||
except AttributeError:
|
||||
copy2(src, dest)
|
||||
|
||||
HardLink = ActionFactory(hard_link,
|
||||
lambda dest, src: 'Hardlinking %s to %s' % (src, dest),
|
||||
convert=str)
|
||||
|
||||
def generate(env):
|
||||
#env.AddMethod(InstallWithSuffix)
|
||||
from SCons.Script.SConscript import SConsEnvironment
|
||||
|
Loading…
x
Reference in New Issue
Block a user