Ensure that scons exits with an error...

...if building of a disabled target is requested

either directly or indirectly.
This commit is contained in:
Sergey Popov 2009-05-03 10:32:00 +00:00
parent 0493adc95e
commit 37c98b7a1d
2 changed files with 11 additions and 5 deletions

View file

@ -267,6 +267,8 @@ if env["prereqs"]:
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 @@ def InstallManpages(env, component):
# 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":

View file

@ -306,15 +306,20 @@ libwesnoth_extras = client_env.Library("wesnoth_extras", wesnoth_sources)
# 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)