OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 """Run 'candle' and 'light' to transform .wxs to .msi.""" | |
7 | |
8 import os | |
9 import subprocess | |
10 import sys | |
11 | |
12 def run(command, filter=None): | |
13 popen = subprocess.Popen( | |
14 command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
15 out, _ = popen.communicate() | |
16 for line in out.splitlines(): | |
17 if filter and line.strip() != filter: | |
18 print line | |
19 return popen.returncode | |
20 | |
21 def main(): | |
22 parameters = { | |
alexeypa (please no reviews)
2012/05/18 23:46:40
The command line is not validated in any way so it
scottmg
2012/05/19 00:59:55
Switched to use optparse and named parameters inst
| |
23 'wix_path': os.path.normpath(sys.argv[1]), | |
24 'version': sys.argv[2], | |
25 'product_dir': os.path.normpath(sys.argv[3]), | |
26 'intermediate': os.path.normpath(sys.argv[4]), | |
27 'platformsdk_path': os.path.normpath(sys.argv[5]), | |
28 'defines': sys.argv[6], | |
alexeypa (please no reviews)
2012/05/18 23:46:40
This will break as soon as someone adds another de
scottmg
2012/05/19 00:59:55
Oops, yes, it should have been <(wix_defines), not
alexeypa (please no reviews)
2012/05/21 16:24:50
Never mind. optparse should be enough for our need
| |
29 'input': os.path.normpath(sys.argv[7]), | |
30 'output': os.path.normpath(sys.argv[8]), | |
31 } | |
32 | |
33 common = ( | |
34 '-nologo ' | |
35 '-ext %(wix_path)s\\WixFirewallExtension.dll ' | |
36 '-ext %(wix_path)s\\WixUIExtension.dll ' | |
37 '-ext %(wix_path)s\\WixUtilExtension.dll ' | |
38 '-dVersion=%(version)s ' | |
39 '-dFileSource=%(product_dir)s ' | |
40 '-dIconPath=resources/chromoting.ico ' | |
41 '-dSasDllPath=%(platformsdk_path)s/redist/x86/sas.dll ' | |
42 '%(defines)s ' | |
43 ) | |
44 | |
45 candle_template = ('%(wix_path)s\\candle ' + | |
46 common + | |
47 '-out %(intermediate)s.wixobj ' + | |
48 '%(input)s ') | |
49 rc = run(candle_template % parameters, os.path.basename(parameters['input'])) | |
50 if rc: | |
51 return rc | |
52 | |
53 light_template = ('%(wix_path)s\\light ' + | |
54 common + | |
55 '-cultures:en-us ' + | |
56 '-sw1076 ' + | |
57 '-out %(output)s ' + | |
58 '%(intermediate)s.wixobj ') | |
59 rc = run(light_template % parameters) | |
60 if rc: | |
61 return rc | |
62 | |
63 if __name__ == "__main__": | |
64 sys.exit(main()) | |
OLD | NEW |