Author: loonycyborg
Date: Sun May  3 12:32:00 2009
New Revision: 35426

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35426&view=rev
Log:
Ensure that scons exits with an error if building of a disabled target is 
requested

either directly or indirectly.

Modified:
    trunk/SConstruct
    trunk/src/SConscript

Modified: trunk/SConstruct
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/SConstruct?rev=35426&r1=35425&r2=35426&view=diff
==============================================================================
--- trunk/SConstruct (original)
+++ trunk/SConstruct Sun May  3 12:32:00 2009
@@ -267,6 +267,8 @@
 
     have_test_prereqs = have_client_prereqs and have_server_prereqs and 
conf.CheckBoost('unit_test_framework', require_version = "1.33.0") or 
Warning("Unit tests are disabled because their prerequisites are not met.")
     test_env = conf.Finish()
+    if not have_test_prereqs and "test" in env["default_targets"]:
+        env["default_targets"].remove("test")
 
 #    have_boost_asio = \
 #        conf.CheckBoost("system", require_version = "1.35.0") and \
@@ -476,13 +478,12 @@
 
 # Now the actual installation productions
 
+# The game and associated resources
+env.InstallBinary(wesnoth)
 env.InstallData("datadir", "wesnoth", map(Dir, installable_subs))
 env.InstallData("docdir",  "wesnoth", [Glob("doc/manual/*.html"), 
Dir("doc/manual/styles"), Dir("doc/manual/images")])
 if env["nls"]:
     env.InstallData("localedir", "wesnoth", Dir("translations"))
-
-# The game and associated resources
-env.InstallBinary(wesnoth)
 InstallManpages(env, "wesnoth")
 if have_client_prereqs and have_X and env["desktop_entry"]:
      if sys.platform == "darwin":

Modified: trunk/src/SConscript
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/SConscript?rev=35426&r1=35425&r2=35426&view=diff
==============================================================================
--- trunk/src/SConscript (original)
+++ trunk/src/SConscript Sun May  3 12:32:00 2009
@@ -306,15 +306,20 @@
 # Target declarations
 #
 
+def error_action(target, source, env):
+    from SCons.Errors import UserError
+    raise UserError, "Target disabled because its prerequisites are not met"
+
 def WesnothProgram(env, target, source, can_build, **kw):
     if can_build:
         if env["build"] == "base":
             bin = env.Program(target, source, **kw)
         else:
             bin = env.Program("#/" + target + build_suffix, source, **kw)
+        env.Alias(target, bin)
     else:
-        bin = None
-    env.Alias(target, bin)
+        bin = env.Alias(target, [], error_action)
+        AlwaysBuild(bin)
     exec target + " = bin"
     Export(target)
 


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

Reply via email to