File: nsis.py

package info (click to toggle)
glob2 0.9.4.4-2.3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 34,452 kB
  • ctags: 10,285
  • sloc: cpp: 89,684; python: 868; ansic: 259; makefile: 62; sh: 49
file content (39 lines) | stat: -rw-r--r-- 1,062 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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