Author: loonycyborg
Date: Sun Nov  2 19:10:48 2008
New Revision: 30538

URL: http://svn.gna.org/viewcvs/wesnoth?rev=30538&view=rev
Log:
Added env.InstallBinary wrapper method and made use of it.

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

Modified: trunk/SConstruct
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/SConstruct?rev=30538&r1=30537&r2=30538&view=diff
==============================================================================
--- trunk/SConstruct (original)
+++ trunk/SConstruct Sun Nov  2 19:10:48 2008
@@ -459,7 +459,7 @@
 env.InstallData("docdir",  "wesnoth", Dir("doc/manual"))
 
 # The game and associated resources
-env.Alias("install-wesnoth", env.InstallWithSuffix(bindir, wesnoth))
+env.InstallBinary(wesnoth)
 InstallManpages(env, "wesnoth")
 if have_client_prereqs and have_X and env["desktop_entry"]:
      if sys.platform == "darwin":
@@ -473,23 +473,24 @@
 env.InstallData("python_site_packages_dir", "pytools", map(lambda module: 
os.path.join("data", "tools", "wesnoth", module), pythonmodules))
 
 # Wesnoth MP server install
-install_wesnothd = env.InstallWithSuffix(bindir, wesnothd)
-env.Alias("install-wesnothd", install_wesnothd)
+env.InstallBinary(wesnothd)
 InstallManpages(env, "wesnothd")
 if not access(fifodir, F_OK):
-    env.AddPostAction(install_wesnothd, [
+    fifodir = env.Command(fifodir, [], [
         Mkdir(fifodir),
         Chmod(fifodir, 0700),
         Action("chown %s:%s %s" %
                (env["server_uid"], env["server_gid"], fifodir)),
         ])
+    AlwaysBuild(fifodir)
+    env.Alias("install-wesnothd", fifodir)
 
 # Wesnoth campaign server
-env.Alias("install-campaignd", env.InstallWithSuffix(bindir, campaignd))
+env.InstallBinary(campaignd)
 
 # And the artists' tools
-env.Alias("install-cutter", env.InstallWithSuffix(bindir, cutter))
-env.Alias("install-exploder", env.InstallWithSuffix(bindir, exploder))
+env.InstallBinary(cutter)
+env.InstallBinary(exploder)
 
 # Compute things for default install based on which targets have been created.
 install = env.Alias('install', [])

Modified: trunk/scons/install.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/scons/install.py?rev=30538&r1=30537&r2=30538&view=diff
==============================================================================
--- trunk/scons/install.py (original)
+++ trunk/scons/install.py Sun Nov  2 19:10:48 2008
@@ -44,11 +44,6 @@
         shutil.copy2(str(source), target)
     return None
 
-def InstallWithSuffix(env, target, source):
-    if not 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):
@@ -69,6 +64,16 @@
 HardLink = ActionFactory(hard_link,
                          lambda dest, src: 'Hardlinking %s to %s' % (src, 
dest))
 
+def InstallBinary(env, source):
+    if not source:
+        return source
+
+    binary = source[0].name
+    installdir = env.subst(os.path.join(env["destdir"], 
env["bindir"].lstrip("/")))
+    env.Alias("install-" + binary, 
+        env.InstallAs(os.path.join(installdir, binary + 
env["program_suffix"]), source)
+    )
+
 def InstallData(env, datadir, component, source, subdir = ""):
     installdir = Dir(env.subst(os.path.join(env["destdir"], 
env[datadir].lstrip("/"), subdir)))
     sources = map(Entry, Flatten([source]))
@@ -87,7 +92,7 @@
 def generate(env):
     #env.AddMethod(InstallWithSuffix)
     from SCons.Script.SConscript import SConsEnvironment
-    SConsEnvironment.InstallWithSuffix = InstallWithSuffix
+    SConsEnvironment.InstallBinary = InstallBinary
     SConsEnvironment.InstallData = InstallData
 
     
env.Append(BUILDERS={'InstallFiltered':Builder(action=InstallFilteredHook)})


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to