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 """Script to create Chrome Installer archive. | 6 """Script to create Chrome Installer archive. |
7 | 7 |
8 This script is used to create an archive of all the files required for a | 8 This script is used to create an archive of all the files required for a |
9 Chrome install in appropriate directory structure. It reads chrome.release | 9 Chrome install in appropriate directory structure. It reads chrome.release |
10 file as input, creates chrome.7z archive, compresses setup.exe and | 10 file as input, creates chrome.7z archive, compresses setup.exe and |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 def DoComponentBuildTasks(staging_dir, build_dir, current_version): | 339 def DoComponentBuildTasks(staging_dir, build_dir, current_version): |
340 # Get the required directories for the upcoming operations. | 340 # Get the required directories for the upcoming operations. |
341 chrome_dir = os.path.join(staging_dir, CHROME_DIR) | 341 chrome_dir = os.path.join(staging_dir, CHROME_DIR) |
342 version_dir = os.path.join(chrome_dir, current_version) | 342 version_dir = os.path.join(chrome_dir, current_version) |
343 installer_dir = os.path.join(version_dir, 'Installer') | 343 installer_dir = os.path.join(version_dir, 'Installer') |
344 # |installer_dir| is technically only created post-install, but we need it | 344 # |installer_dir| is technically only created post-install, but we need it |
345 # now to add setup.exe's config and manifest to the archive. | 345 # now to add setup.exe's config and manifest to the archive. |
346 if not os.path.exists(installer_dir): | 346 if not os.path.exists(installer_dir): |
347 os.mkdir(installer_dir) | 347 os.mkdir(installer_dir) |
348 | 348 |
| 349 # Copy the relevant CRT DLLs to |build_dir|. We copy DLLs from all versions |
| 350 # of VS installed to make sure we have the correct CRT version, unused DLLs |
| 351 # should not conflict with the others anyways. |
| 352 crt_dlls = [] |
| 353 if build_dir.endswith('Debug/'): |
| 354 crt_dlls = glob.glob( |
| 355 "C:/Program Files (x86)/Microsoft Visual Studio */VC/redist/" |
| 356 "Debug_NonRedist/x86/Microsoft.*.DebugCRT/*.dll") |
| 357 elif build_dir.endswith('Release/'): |
| 358 crt_dlls = glob.glob( |
| 359 "C:/Program Files (x86)/Microsoft Visual Studio */VC/redist/x86/" |
| 360 "Microsoft.*.CRT/*.dll") |
| 361 else: |
| 362 print ("Warning: CRT DLLs not copied, could not determine build " |
| 363 "configuration from output directory.") |
| 364 |
| 365 for dll in crt_dlls: |
| 366 shutil.copy(dll, build_dir) |
| 367 |
349 # Copy all the DLLs in |build_dir| to the version directory. Simultaneously | 368 # Copy all the DLLs in |build_dir| to the version directory. Simultaneously |
350 # build a list of their names to mark them as dependencies of chrome.exe and | 369 # build a list of their names to mark them as dependencies of chrome.exe and |
351 # setup.exe later. | 370 # setup.exe later. |
352 dlls = glob.glob(os.path.join(build_dir, '*.dll')) | 371 dlls = glob.glob(os.path.join(build_dir, '*.dll')) |
353 dll_names = [] | 372 dll_names = [] |
354 for dll in dlls: | 373 for dll in dlls: |
355 shutil.copy(dll, version_dir) | 374 shutil.copy(dll, version_dir) |
356 dll_names.append(os.path.splitext(os.path.basename(dll))[0]) | 375 dll_names.append(os.path.splitext(os.path.basename(dll))[0]) |
357 | 376 |
358 exe_config = ( | 377 exe_config = ( |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 help='Whether to include HiDPI resource files.') | 525 help='Whether to include HiDPI resource files.') |
507 parser.add_option('--enable_metro', default='0', | 526 parser.add_option('--enable_metro', default='0', |
508 help='Whether to include resource files from the "METRO" section of the ' | 527 help='Whether to include resource files from the "METRO" section of the ' |
509 'input file.') | 528 'input file.') |
510 parser.add_option('--component_build', default='0', | 529 parser.add_option('--component_build', default='0', |
511 help='Whether this archive is packaging a component build.') | 530 help='Whether this archive is packaging a component build.') |
512 | 531 |
513 options, args = parser.parse_args() | 532 options, args = parser.parse_args() |
514 if not options.build_dir: | 533 if not options.build_dir: |
515 parser.error('You must provide a build dir.') | 534 parser.error('You must provide a build dir.') |
| 535 elif not options.build_dir.endswith('/'): |
| 536 options.build_dir += '/' |
516 | 537 |
517 if not options.staging_dir: | 538 if not options.staging_dir: |
518 parser.error('You must provide a staging dir.') | 539 parser.error('You must provide a staging dir.') |
519 | 540 |
520 if not options.input_file: | 541 if not options.input_file: |
521 parser.error('You must provide an input file') | 542 parser.error('You must provide an input file') |
522 | 543 |
523 if not options.output_dir: | 544 if not options.output_dir: |
524 options.output_dir = options.build_dir | 545 options.output_dir = options.build_dir |
525 | 546 |
526 if not options.resource_file_path: | 547 if not options.resource_file_path: |
527 options.resource_file_path = os.path.join(options.build_dir, | 548 options.resource_file_path = os.path.join(options.build_dir, |
528 MINI_INSTALLER_INPUT_FILE) | 549 MINI_INSTALLER_INPUT_FILE) |
529 | 550 |
530 return options | 551 return options |
531 | 552 |
532 | 553 |
533 if '__main__' == __name__: | 554 if '__main__' == __name__: |
534 print sys.argv | 555 print sys.argv |
535 sys.exit(main(_ParseOptions())) | 556 sys.exit(main(_ParseOptions())) |
OLD | NEW |