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 from optparse import OptionParser |
| 9 import os |
| 10 import subprocess |
| 11 import sys |
| 12 |
| 13 def run(command, filter=None): |
| 14 popen = subprocess.Popen( |
| 15 command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| 16 out, _ = popen.communicate() |
| 17 for line in out.splitlines(): |
| 18 if filter and line.strip() != filter: |
| 19 print line |
| 20 return popen.returncode |
| 21 |
| 22 def main(): |
| 23 parser = OptionParser() |
| 24 parser.add_option('--wix_path', dest='wix_path') |
| 25 parser.add_option('--version', dest='version') |
| 26 parser.add_option('--product_dir', dest='product_dir') |
| 27 parser.add_option('--intermediate_root', dest='intermediate_root') |
| 28 parser.add_option('--platformsdk_path', dest='platformsdk_path') |
| 29 parser.add_option('--defines', dest='defines') |
| 30 parser.add_option('--input', dest='input') |
| 31 parser.add_option('--output', dest='output') |
| 32 options, args = parser.parse_args() |
| 33 if args: |
| 34 parser.error("no positional arguments expected") |
| 35 parameters = dict(options.__dict__) |
| 36 |
| 37 common = ( |
| 38 '-nologo ' |
| 39 '-ext %(wix_path)s\\WixFirewallExtension.dll ' |
| 40 '-ext %(wix_path)s\\WixUIExtension.dll ' |
| 41 '-ext %(wix_path)s\\WixUtilExtension.dll ' |
| 42 '-dVersion=%(version)s ' |
| 43 '-dFileSource=%(product_dir)s ' |
| 44 '-dIconPath=resources/chromoting.ico ' |
| 45 '-dSasDllPath=%(platformsdk_path)s/redist/x86/sas.dll ' |
| 46 '%(defines)s ' |
| 47 ) |
| 48 |
| 49 candle_template = ('%(wix_path)s\\candle ' + |
| 50 common + |
| 51 '-out %(intermediate_root)s.wixobj ' + |
| 52 '%(input)s ') |
| 53 rc = run(candle_template % parameters, os.path.basename(parameters['input'])) |
| 54 if rc: |
| 55 return rc |
| 56 |
| 57 light_template = ('%(wix_path)s\\light ' + |
| 58 common + |
| 59 '-cultures:en-us ' + |
| 60 '-sw1076 ' + |
| 61 '-out %(output)s ' + |
| 62 '%(intermediate_root)s.wixobj ') |
| 63 rc = run(light_template % parameters) |
| 64 if rc: |
| 65 return rc |
| 66 |
| 67 if __name__ == "__main__": |
| 68 sys.exit(main()) |
OLD | NEW |