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 """Takes the output of the build step and zips the distributable package. | 6 """Takes the output of the build step and zips the distributable package. |
7 | 7 |
8 This script assumes the build script has been run to compile the add-in. | 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 | 9 It zips up all files required for the add-in installation and places the |
10 result in out/NativeClientVSAddin.zip | 10 result in out/NativeClientVSAddin.zip |
11 """ | 11 """ |
12 | 12 |
13 import glob | |
14 import os | 13 import os |
15 import shutil | |
16 import zipfile | 14 import zipfile |
17 | 15 |
18 # Root output directory | 16 # Root output directory |
19 BUILD_OUTPUT_DIRECTORY = "../../out/NativeClientVSAddIn/" | 17 BUILD_OUTPUT_DIRECTORY = "../../out/NativeClientVSAddIn/" |
20 | 18 |
21 # Directory containing static installer resources | 19 # Directory containing static installer resources |
22 RESOURCE_DIRECTORY = "./InstallerResources" | 20 RESOURCE_DIRECTORY = "./InstallerResources" |
23 | 21 |
24 # Directory that contains the build assemblies | 22 # Directory that contains the build assemblies |
25 ASSEMBLY_DIRECTORY = os.path.join(BUILD_OUTPUT_DIRECTORY, "Debug") | 23 ASSEMBLY_DIRECTORY = os.path.join(BUILD_OUTPUT_DIRECTORY, "Debug") |
26 | 24 |
27 # Base name of the final zip file | 25 # Base name of the final zip file |
28 OUTPUT_NAME = os.path.join(BUILD_OUTPUT_DIRECTORY, "NativeClientVSAddIn.zip") | 26 OUTPUT_NAME = os.path.join(BUILD_OUTPUT_DIRECTORY, "NativeClientVSAddIn.zip") |
29 | 27 |
30 # List of paths to files to include in the zip file | 28 # List of paths to files to include in the zip file |
31 FILE_LIST = [ | 29 FILE_LIST = [ |
32 os.path.join(RESOURCE_DIRECTORY, 'NativeClientVSAddIn.AddIn'), | 30 os.path.join(RESOURCE_DIRECTORY, 'NativeClientVSAddIn.AddIn'), |
33 os.path.join(RESOURCE_DIRECTORY, 'install.py'), | 31 os.path.join(RESOURCE_DIRECTORY, 'install.py'), |
34 os.path.join(ASSEMBLY_DIRECTORY, 'NativeClientVSAddIn.dll')] | 32 os.path.join(ASSEMBLY_DIRECTORY, 'NativeClientVSAddIn.dll')] |
35 | 33 |
36 def main(): | 34 def main(): |
37 # Zip the package | 35 # Zip the package |
38 out_file = zipfile.ZipFile(OUTPUT_NAME, 'w') | 36 out_file = zipfile.ZipFile(OUTPUT_NAME, 'w') |
39 for file_path in FILE_LIST: | 37 for file_path in FILE_LIST: |
40 out_file.write(file_path, os.path.basename(file_path), zipfile.ZIP_DEFLATED) | 38 out_file.write(file_path, os.path.basename(file_path), zipfile.ZIP_DEFLATED) |
41 out_file.close() | 39 out_file.close() |
42 | 40 |
43 if __name__ == '__main__': | 41 if __name__ == '__main__': |
44 main() | 42 main() |
OLD | NEW |