Chromium Code Reviews| 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 """Takes the output of the build step and zips the distributable package. | |
| 7 | |
| 8 This script assumes the build script has been run to compile the add-in. | |
| 9 It zips up all files required for the add-in installation and places the | |
| 10 result in out/NativeClientVSAddin.zip | |
| 11 """ | |
| 12 | |
| 13 import glob | |
| 14 import os | |
| 15 import shutil | |
| 16 import zipfile | |
| 17 | |
| 18 # Directory containing static installer resources | |
| 19 resource_directory = "./InstallerResources" | |
| 20 | |
| 21 # Directory that contains the build assemblies | |
| 22 assembly_directory = "../../out/NativeClientVSAddIn/Debug" | |
|
binji
2012/07/17 00:05:58
factor output directory into its own variable and
tysand
2012/07/17 01:18:18
Done.
| |
| 23 | |
| 24 # Directory that we will zip in the end | |
| 25 zip_directory = "../../out/NativeClientVSAddIn/Package" | |
| 26 | |
| 27 # Base name of the final zip file | |
| 28 output_name = "../../out/NativeClientVSAddIn/NativeClientVSAddIn.zip" | |
| 29 | |
| 30 # Ensure the output directory is empty | |
| 31 if os.path.exists(zip_directory): | |
| 32 shutil.rmtree(zip_directory) | |
| 33 os.makedirs(zip_directory) | |
| 34 | |
| 35 # Copy files into output directory | |
| 36 shutil.copy(os.path.join(resource_directory, 'NativeClientVSAddIn.AddIn'), | |
|
binji
2012/07/17 00:05:58
make list of files to copy and loop over it.
tysand
2012/07/17 01:18:18
Done.
| |
| 37 zip_directory) | |
| 38 shutil.copy(os.path.join(resource_directory, 'install.py'), | |
| 39 zip_directory) | |
| 40 shutil.copy(os.path.join(assembly_directory, 'NativeClientVSAddIn.dll'), | |
| 41 zip_directory) | |
| 42 | |
| 43 # Zip the package | |
| 44 out_file = zipfile.ZipFile(output_name, 'w') | |
| 45 for file_name in glob.glob(zip_directory + "/*"): | |
|
binji
2012/07/17 00:05:58
rather than glob, just use the copy list from abov
tysand
2012/07/17 01:18:18
Done.
| |
| 46 out_file.write(file_name, os.path.basename(file_name), zipfile.ZIP_DEFLATED) | |
| 47 out_file.close() | |
| OLD | NEW |