Index: remoting/dark_and_candle_and_light.py |
diff --git a/remoting/dark_and_candle_and_light.py b/remoting/dark_and_candle_and_light.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..32d0e889db6943003ce899738dbd90c89a79fd86 |
--- /dev/null |
+++ b/remoting/dark_and_candle_and_light.py |
@@ -0,0 +1,61 @@ |
+#!/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 'dark', 'candle', and 'light', to confirm that an msi can be unpacked |
+repacked successfully.""" |
+ |
+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 = { |
+ 'wix_path': os.path.normpath(sys.argv[1]), |
+ 'input': os.path.normpath(sys.argv[2]), |
+ 'intermediate_root': os.path.normpath(sys.argv[3]), |
+ 'intermediate_dir': os.path.normpath(sys.argv[4]), |
+ 'output': os.path.normpath(sys.argv[5]), |
+ } |
+ |
+ dark_template = ('%(wix_path)s\\dark ' + |
+ '-nologo ' + |
+ '%(input)s ' + |
+ '-o %(intermediate_root)s.wxs ' + |
+ '-x %(intermediate_dir)s') |
+ rc = run(dark_template % parameters) |
+ if rc: |
+ return rc |
+ |
+ candle_template = ('%(wix_path)s\\candle ' + |
+ '-nologo ' + |
+ '%(intermediate_root)s.wxs ' + |
+ '-o %(intermediate_root)s.wixobj ' + |
+ '-ext %(wix_path)s\\WixFirewallExtension.dll') |
+ rc = run(candle_template % parameters, |
+ os.path.basename(parameters['intermediate_root']) + '.wxs') |
+ if rc: |
+ return rc |
+ |
+ light_template = ('%(wix_path)s\\light ' + |
+ '-nologo ' + |
+ '%(intermediate_root)s.wixobj ' + |
+ '-o %(output)s ' + |
+ '-ext %(wix_path)s\\WixFirewallExtension.dll ' + |
+ '-sw1076 ') |
+ rc = run(light_template % parameters) |
+ if rc: |
+ return rc |
+ |
+if __name__ == "__main__": |
+ sys.exit(main()) |