[kupfer] waf: Fix checking for optional features



commit 90bd1142e4fbc4baab119a0b762f0c5dafa86a23
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Fri Mar 4 16:27:51 2011 +0100

    waf: Fix checking for optional features
    
    In the jump to Waf 1.6, most of the waf code checking for optional
    dependencies changed in meaning so that they became mandatory
    dependencies. Fix this by using the new style wscript exception
    handling.

 help/wscript |    9 ++++++---
 wscript      |   10 ++++++----
 2 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/help/wscript b/help/wscript
index 3acf41c..a08e291 100644
--- a/help/wscript
+++ b/help/wscript
@@ -74,9 +74,12 @@ TaskGen.after('init_mallard')(apply_mallard)
 def options(opt):
 	pass
 
-def configure(conf):
-	xml2po = conf.find_program('xml2po', var='XML2PO')
-	conf.env['XML2POFLAGS'] = '-mmallard -p'
+def configure(ctx):
+	try:
+		ctx.find_program('xml2po', var='XML2PO')
+		ctx.env['XML2POFLAGS'] = '-mmallard -p'
+	except ctx.errors.ConfigurationError:
+		pass
 
 def build(bld):
 	if bld.env["XML2PO"]:
diff --git a/wscript b/wscript
index 7e8ed6b..1966167 100644
--- a/wscript
+++ b/wscript
@@ -136,8 +136,9 @@ def configure(conf):
 			"rst2man": "Generate and install man page",
 		}
 	for prog in opt_build_programs:
-		prog_path = conf.find_program(prog, var=prog.replace("-", "_").upper())
-		if not prog_path:
+		try:
+			conf.find_program(prog, var=prog.replace("-", "_").upper())
+		except conf.errors.ConfigurationError:
 			Logs.pprint("YELLOW",
 			             "Optional, allows: %s" % opt_build_programs[prog])
 
@@ -166,8 +167,9 @@ def configure(conf):
 		}
 
 	for prog in opt_programs:
-		prog_path = conf.find_program(prog, var=prog.replace("-", "_").upper())
-		if not prog_path:
+		try:
+			conf.find_program(prog, var=prog.replace("-", "_").upper())
+		except conf.errors.ConfigurationError:
 			Logs.pprint("YELLOW", "Optional, allows: %s" % opt_programs[prog])
 
 	try:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]