Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: visual_studio/NativeClientVSAddIn/create_package.py

Issue 10790023: VS-Addin Build/Test/Install scripts (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: visual_studio/NativeClientVSAddIn/create_package.py
diff --git a/visual_studio/NativeClientVSAddIn/create_package.py b/visual_studio/NativeClientVSAddIn/create_package.py
new file mode 100644
index 0000000000000000000000000000000000000000..5d265691556cf0f3065f967816f512bc993e8553
--- /dev/null
+++ b/visual_studio/NativeClientVSAddIn/create_package.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Takes the output of the build step and zips the distributable package.
+
+This script assumes the build script has been run to compile the add-in.
+It zips up all files required for the add-in installation and places the
+result in out/NativeClientVSAddin.zip
+"""
+
+import glob
+import os
+import shutil
+import zipfile
+
+# Directory containing static installer resources
+resource_directory = "./InstallerResources"
+
+# Directory that contains the build assemblies
+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.
+
+# Directory that we will zip in the end
+zip_directory = "../../out/NativeClientVSAddIn/Package"
+
+# Base name of the final zip file
+output_name = "../../out/NativeClientVSAddIn/NativeClientVSAddIn.zip"
+
+# Ensure the output directory is empty
+if os.path.exists(zip_directory):
+ shutil.rmtree(zip_directory)
+os.makedirs(zip_directory)
+
+# Copy files into output directory
+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.
+ zip_directory)
+shutil.copy(os.path.join(resource_directory, 'install.py'),
+ zip_directory)
+shutil.copy(os.path.join(assembly_directory, 'NativeClientVSAddIn.dll'),
+ zip_directory)
+
+# Zip the package
+out_file = zipfile.ZipFile(output_name, 'w')
+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.
+ out_file.write(file_name, os.path.basename(file_name), zipfile.ZIP_DEFLATED)
+out_file.close()

Powered by Google App Engine
This is Rietveld 408576698