Index: remoting/candle_and_light.py |
diff --git a/remoting/candle_and_light.py b/remoting/candle_and_light.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..93dbcc67f25f3227377d6918f2b889c03bd0b3aa |
--- /dev/null |
+++ b/remoting/candle_and_light.py |
@@ -0,0 +1,64 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+"""Run 'candle' and 'light' to transform .wxs to .msi.""" |
+ |
+import os |
+import subprocess |
+import sys |
+ |
+def run(command, filter=None): |
+ popen = subprocess.Popen( |
+ command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
+ out, _ = popen.communicate() |
+ for line in out.splitlines(): |
+ if filter and line.strip() != filter: |
+ print line |
+ return popen.returncode |
+ |
+def main(): |
+ 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
|
+ 'wix_path': os.path.normpath(sys.argv[1]), |
+ 'version': sys.argv[2], |
+ 'product_dir': os.path.normpath(sys.argv[3]), |
+ 'intermediate': os.path.normpath(sys.argv[4]), |
+ 'platformsdk_path': os.path.normpath(sys.argv[5]), |
+ '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
|
+ 'input': os.path.normpath(sys.argv[7]), |
+ 'output': os.path.normpath(sys.argv[8]), |
+ } |
+ |
+ common = ( |
+ '-nologo ' |
+ '-ext %(wix_path)s\\WixFirewallExtension.dll ' |
+ '-ext %(wix_path)s\\WixUIExtension.dll ' |
+ '-ext %(wix_path)s\\WixUtilExtension.dll ' |
+ '-dVersion=%(version)s ' |
+ '-dFileSource=%(product_dir)s ' |
+ '-dIconPath=resources/chromoting.ico ' |
+ '-dSasDllPath=%(platformsdk_path)s/redist/x86/sas.dll ' |
+ '%(defines)s ' |
+ ) |
+ |
+ candle_template = ('%(wix_path)s\\candle ' + |
+ common + |
+ '-out %(intermediate)s.wixobj ' + |
+ '%(input)s ') |
+ rc = run(candle_template % parameters, os.path.basename(parameters['input'])) |
+ if rc: |
+ return rc |
+ |
+ light_template = ('%(wix_path)s\\light ' + |
+ common + |
+ '-cultures:en-us ' + |
+ '-sw1076 ' + |
+ '-out %(output)s ' + |
+ '%(intermediate)s.wixobj ') |
+ rc = run(light_template % parameters) |
+ if rc: |
+ return rc |
+ |
+if __name__ == "__main__": |
+ sys.exit(main()) |