diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-08-11 19:45:19 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-08-11 19:45:19 (GMT) |
commit | c6ee342203e719572a2f9e371eac3bb85770988e (patch) | |
tree | 1d5f3672458ba33b07a3cc1820ff167a69d6726e /BuildTools/SCons/Tools | |
parent | 0a2f7274a08ab5ed6e1305977d85fa02b01aaea7 (diff) | |
download | swift-contrib-c6ee342203e719572a2f9e371eac3bb85770988e.zip swift-contrib-c6ee342203e719572a2f9e371eac3bb85770988e.tar.bz2 |
Added NSIS tool.
Diffstat (limited to 'BuildTools/SCons/Tools')
-rw-r--r-- | BuildTools/SCons/Tools/nsis.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/BuildTools/SCons/Tools/nsis.py b/BuildTools/SCons/Tools/nsis.py new file mode 100644 index 0000000..76f19fc --- /dev/null +++ b/BuildTools/SCons/Tools/nsis.py @@ -0,0 +1,39 @@ +import re, os +import SCons.Util +nsisFiles_re = re.compile(r'^\s*File "([^"]*)"', re.M) + +""" +TODO: + - Extract the target from the nsis file + - When a target is provided use the output function +""" + +def generate(env) : + """Add Builders and construction variables for qt to an Environment.""" + print "Loading nsis tool..." + + Builder = SCons.Builder.Builder + + env['NSIS_MAKENSIS'] = 'makensis' + env['NSIS_OPTIONS'] = '' + def winToLocalReformat(path) : + return os.path.join(*path.split("\\")) + def scanNsisContent(node, env, path, arg): + contents = node.get_contents() + includes = nsisFiles_re.findall(contents) + includes = [ winToLocalReformat(include) for include in includes ] + return filter(lambda x: x.rfind('*')==-1, includes) + nsisscanner = env.Scanner(name = 'nsisfile', + function = scanNsisContent, + argument = None, + skeys = ['.nsi']) + nsisbuilder = Builder( + action = '$NSIS_MAKENSIS $NSIS_OPTIONS $SOURCE', + source_scanner = nsisscanner, + single_source = True + ) + env.Append( BUILDERS={'Nsis' : nsisbuilder} ) + +def exists(env) : + return True + |