mail[Wesnoth-commits] r27556 - in /trunk: SConstruct scons/install.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by loonycyborg on June 28, 2008 - 16:01:
Author: loonycyborg
Date: Sat Jun 28 16:01:08 2008
New Revision: 27556

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27556&view=rev
Log:
Made scons hardlink binaries to working copy root instead of copying them.

Modified:
    trunk/SConstruct
    trunk/scons/install.py

Modified: trunk/SConstruct
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/SConstruct?rev=27556&r1=27555&r2=27556&view=diff
==============================================================================
--- trunk/SConstruct (original)
+++ trunk/SConstruct Sat Jun 28 16:01:08 2008
@@ -312,7 +312,8 @@
 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"]))

Modified: trunk/scons/install.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/scons/install.py?rev=27556&r1=27555&r2=27556&view=diff
==============================================================================
--- trunk/scons/install.py (original)
+++ trunk/scons/install.py Sat Jun 28 16:01:08 2008
@@ -49,6 +49,27 @@
         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




Related Messages


Powered by MHonArc, Updated Sat Jun 28 16:21:56 2008