OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Generates .msi from a .zip archive or an unpacked directory. | 6 """Generates .msi from a .zip archive or an unpacked directory. |
7 | 7 |
8 The structure of the input archive or directory should look like this: | 8 The structure of the input archive or directory should look like this: |
9 | 9 |
10 +- archive.zip | 10 +- archive.zip |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 if 'bind_path' not in parameters: | 220 if 'bind_path' not in parameters: |
221 print 'The binding path is not specified' | 221 print 'The binding path is not specified' |
222 return 1 | 222 return 1 |
223 | 223 |
224 wxs = os.path.join(source_dir, parameters['source']) | 224 wxs = os.path.join(source_dir, parameters['source']) |
225 | 225 |
226 # Add the binding path to the light-specific parameters. | 226 # Add the binding path to the light-specific parameters. |
227 bind_path = os.path.join(source_dir, parameters['bind_path']) | 227 bind_path = os.path.join(source_dir, parameters['bind_path']) |
228 parameters = Merge(parameters, {'light': {'switches': ['-b', bind_path]}}) | 228 parameters = Merge(parameters, {'light': {'switches': ['-b', bind_path]}}) |
229 | 229 |
| 230 target_arch = parameters['target_arch'] |
| 231 if target_arch == 'ia32': |
| 232 arch_param = 'x86' |
| 233 elif target_arch == 'x64': |
| 234 arch_param = 'x64' |
| 235 else: |
| 236 print 'Invalid target_arch parameter value' |
| 237 return 1 |
| 238 |
| 239 # Add the architecture to candle-specific parameters. |
| 240 parameters = Merge( |
| 241 parameters, {'candle': {'switches': ['-arch', arch_param]}}) |
| 242 |
230 # Run candle and light to generate the installation. | 243 # Run candle and light to generate the installation. |
231 wixobj = '%(intermediate_dir)s\\%(basename)s.wixobj' % parameters | 244 wixobj = '%(intermediate_dir)s\\%(basename)s.wixobj' % parameters |
232 args = GenerateCommandLine('candle', wxs, wixobj, parameters) | 245 args = GenerateCommandLine('candle', wxs, wixobj, parameters) |
233 rc = Run(args) | 246 rc = Run(args) |
234 if rc: | 247 if rc: |
235 return rc | 248 return rc |
236 | 249 |
237 args = GenerateCommandLine('light', wixobj, target, parameters) | 250 args = GenerateCommandLine('light', wixobj, target, parameters) |
238 rc = Run(args) | 251 rc = Run(args) |
239 if rc: | 252 if rc: |
240 return rc | 253 return rc |
241 | 254 |
242 return 0 | 255 return 0 |
243 | 256 |
244 | 257 |
245 def main(): | 258 def main(): |
246 usage = 'Usage: zip2msi [options] <input.zip> <output.msi>' | 259 usage = 'Usage: zip2msi [options] <input.zip> <output.msi>' |
247 parser = OptionParser(usage=usage) | 260 parser = OptionParser(usage=usage) |
248 parser.add_option('--intermediate_dir', dest='intermediate_dir', default='.') | 261 parser.add_option('--intermediate_dir', dest='intermediate_dir', default='.') |
249 parser.add_option('--wix_path', dest='wix_path', default='.') | 262 parser.add_option('--wix_path', dest='wix_path', default='.') |
| 263 parser.add_option('--target_arch', dest='target_arch', default='x86') |
250 options, args = parser.parse_args() | 264 options, args = parser.parse_args() |
251 if len(args) != 2: | 265 if len(args) != 2: |
252 parser.error('two positional arguments expected') | 266 parser.error('two positional arguments expected') |
253 | 267 |
254 return GenerateMsi(args[1], args[0], dict(options.__dict__)) | 268 return GenerateMsi(args[1], args[0], dict(options.__dict__)) |
255 | 269 |
256 if __name__ == '__main__': | 270 if __name__ == '__main__': |
257 sys.exit(main()) | 271 sys.exit(main()) |
258 | 272 |
OLD | NEW |