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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 if os.path.exists(file_path): | 166 if os.path.exists(file_path): |
167 shutil.rmtree(file_path) | 167 shutil.rmtree(file_path) |
168 os.makedirs(file_path) | 168 os.makedirs(file_path) |
169 | 169 |
170 temp_file_path = os.path.join(staging_dir, TEMP_ARCHIVE_DIR) | 170 temp_file_path = os.path.join(staging_dir, TEMP_ARCHIVE_DIR) |
171 if os.path.exists(temp_file_path): | 171 if os.path.exists(temp_file_path): |
172 shutil.rmtree(temp_file_path) | 172 shutil.rmtree(temp_file_path) |
173 os.makedirs(temp_file_path) | 173 os.makedirs(temp_file_path) |
174 return (file_path, temp_file_path) | 174 return (file_path, temp_file_path) |
175 | 175 |
176 def Readconfig(input_file, current_version): | 176 def Readconfig(input_file, current_version, target_arch): |
177 """Reads config information from input file after setting default value of | 177 """Reads config information from input file after setting default value of |
178 global variabes. | 178 global variabes. |
179 """ | 179 """ |
180 variables = {} | 180 variables = {} |
181 variables['ChromeDir'] = CHROME_DIR | 181 variables['ChromeDir'] = CHROME_DIR |
182 variables['VersionDir'] = os.path.join(variables['ChromeDir'], | 182 variables['VersionDir'] = os.path.join(variables['ChromeDir'], |
183 current_version) | 183 current_version) |
184 variables['ComponentDir'] = '_platform_specific\win_' + target_arch | |
ddorwin
2016/05/19 00:04:26
It's a relative path.
xhwang
2016/05/20 00:22:35
I am still testing this part. Will update this par
| |
184 config = ConfigParser.SafeConfigParser(variables) | 185 config = ConfigParser.SafeConfigParser(variables) |
185 config.read(input_file) | 186 config.read(input_file) |
186 return config | 187 return config |
187 | 188 |
188 def RunSystemCommand(cmd, verbose): | 189 def RunSystemCommand(cmd, verbose): |
189 """Runs |cmd|, prints the |cmd| and its output if |verbose|; otherwise | 190 """Runs |cmd|, prints the |cmd| and its output if |verbose|; otherwise |
190 captures its output and only emits it on failure. | 191 captures its output and only emits it on failure. |
191 """ | 192 """ |
192 if verbose: | 193 if verbose: |
193 print 'Running', cmd | 194 print 'Running', cmd |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
605 '\n'.join(version_assembly_dll_additions), | 606 '\n'.join(version_assembly_dll_additions), |
606 '</assembly>') | 607 '</assembly>') |
607 | 608 |
608 | 609 |
609 def main(options): | 610 def main(options): |
610 """Main method that reads input file, creates archive file and writes | 611 """Main method that reads input file, creates archive file and writes |
611 resource input file. | 612 resource input file. |
612 """ | 613 """ |
613 current_version = BuildVersion(options.build_dir) | 614 current_version = BuildVersion(options.build_dir) |
614 | 615 |
615 config = Readconfig(options.input_file, current_version) | 616 config = Readconfig(options.input_file, current_version, options.target_arch) |
616 | 617 |
617 (staging_dir, temp_dir) = MakeStagingDirectories(options.staging_dir) | 618 (staging_dir, temp_dir) = MakeStagingDirectories(options.staging_dir) |
618 | 619 |
619 prev_version = GetPrevVersion(options.build_dir, temp_dir, | 620 prev_version = GetPrevVersion(options.build_dir, temp_dir, |
620 options.last_chrome_installer, | 621 options.last_chrome_installer, |
621 options.output_name) | 622 options.output_name) |
622 | 623 |
623 # Preferentially copy the files we can find from the output_dir, as | 624 # Preferentially copy the files we can find from the output_dir, as |
624 # this is where we'll find the Syzygy-optimized executables when | 625 # this is where we'll find the Syzygy-optimized executables when |
625 # building the optimized mini_installer. | 626 # building the optimized mini_installer. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
725 MINI_INSTALLER_INPUT_FILE) | 726 MINI_INSTALLER_INPUT_FILE) |
726 | 727 |
727 return options | 728 return options |
728 | 729 |
729 | 730 |
730 if '__main__' == __name__: | 731 if '__main__' == __name__: |
731 options = _ParseOptions() | 732 options = _ParseOptions() |
732 if options.verbose: | 733 if options.verbose: |
733 print sys.argv | 734 print sys.argv |
734 sys.exit(main(options)) | 735 sys.exit(main(options)) |
OLD | NEW |