Tidy up by using option_defaults.
authorCarl Hetherington <cth@carlh.net>
Thu, 2 Apr 2020 12:17:38 +0000 (14:17 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 2 Apr 2020 12:17:38 +0000 (14:17 +0200)
cscript

diff --git a/cscript b/cscript
index 2cdf3149947b543c65739f6dd290116a3751f6e6..c3ce3d9d9bc5b5f4c241dc3cac42088a40d9a198 100644 (file)
--- a/cscript
+++ b/cscript
 import os
 import shutil
 
+option_defaults = { 'force-cpp11': False, 'jpeg': 'oj2' }
+
 def dependencies(target, options):
-    if (target.platform == 'windows' and target.version == 'xp') or (options is not None and 'jpeg' in options and options['jpeg'] == 'oj1'):
+    if (target.platform == 'windows' and target.version == 'xp') or options['jpeg'] == 'oj1':
         return (('libcxml', '0d18df4'), ('openjpeg', 'f166257'), ('asdcplib', 'carl'))
     else:
         return (('libcxml', '0d18df4'), ('openjpeg', '956af06'), ('asdcplib', 'carl'))
 
 def build(target, options):
     cmd = './waf configure --disable-examples --prefix=%s' % target.directory
-    if options is not None and 'jpeg' in options:
-        cmd += ' --jpeg=%s' % options['jpeg']
+    cmd += ' --jpeg=%s' % options['jpeg']
     if target.platform == 'linux':
         cmd += ' --static'
         if not (target.distro == 'ubuntu' and target.version == '18.04'):
@@ -69,7 +70,7 @@ def build(target, options):
     if target.debug:
         cmd += ' --enable-debug'
 
-    if options is not None and 'force-cpp11' in options and options['force-cpp11']:
+    if options['force-cpp11']:
         cmd += ' --force-cpp11'
 
     target.command(cmd)