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 'dark', 'candle', and 'light', to confirm that an msi can be unpacked |
| 7 repacked successfully.""" |
| 8 |
| 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 parameters = { |
| 24 'wix_path': os.path.normpath(sys.argv[1]), |
| 25 'input': os.path.normpath(sys.argv[2]), |
| 26 'intermediate_root': os.path.normpath(sys.argv[3]), |
| 27 'intermediate_dir': os.path.normpath(sys.argv[4]), |
| 28 'output': os.path.normpath(sys.argv[5]), |
| 29 } |
| 30 |
| 31 dark_template = ('%(wix_path)s\\dark ' + |
| 32 '-nologo ' + |
| 33 '%(input)s ' + |
| 34 '-o %(intermediate_root)s.wxs ' + |
| 35 '-x %(intermediate_dir)s') |
| 36 rc = run(dark_template % parameters) |
| 37 if rc: |
| 38 return rc |
| 39 |
| 40 candle_template = ('%(wix_path)s\\candle ' + |
| 41 '-nologo ' + |
| 42 '%(intermediate_root)s.wxs ' + |
| 43 '-o %(intermediate_root)s.wixobj ' + |
| 44 '-ext %(wix_path)s\\WixFirewallExtension.dll') |
| 45 rc = run(candle_template % parameters, |
| 46 os.path.basename(parameters['intermediate_root']) + '.wxs') |
| 47 if rc: |
| 48 return rc |
| 49 |
| 50 light_template = ('%(wix_path)s\\light ' + |
| 51 '-nologo ' + |
| 52 '%(intermediate_root)s.wixobj ' + |
| 53 '-o %(output)s ' + |
| 54 '-ext %(wix_path)s\\WixFirewallExtension.dll ' + |
| 55 '-sw1076 ') |
| 56 rc = run(light_template % parameters) |
| 57 if rc: |
| 58 return rc |
| 59 |
| 60 if __name__ == "__main__": |
| 61 sys.exit(main()) |
OLD | NEW |