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

Unified Diff: visual_studio/NativeClientVSAddIn/create_package.py

Issue 10831030: NaCl settings and completed 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
« no previous file with comments | « visual_studio/NativeClientVSAddIn/build.bat ('k') | visual_studio/NativeClientVSAddIn/developer_deploy.bat » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: visual_studio/NativeClientVSAddIn/create_package.py
diff --git a/visual_studio/NativeClientVSAddIn/create_package.py b/visual_studio/NativeClientVSAddIn/create_package.py
index e5bc0f80afb43db667463bc7c2dfc4c20a09ca92..e7db686c725c9ad7f30a27a04d20a0982e055f10 100644
--- a/visual_studio/NativeClientVSAddIn/create_package.py
+++ b/visual_studio/NativeClientVSAddIn/create_package.py
@@ -13,30 +13,60 @@ result in out/NativeClientVSAddin.zip
import os
import zipfile
-# Root output directory
-BUILD_OUTPUT_DIRECTORY = "../../out/NativeClientVSAddIn/"
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
-# Directory containing static installer resources
-RESOURCE_DIRECTORY = "./InstallerResources"
+# Root output directory.
+BUILD_OUTPUT_DIRECTORY = os.path.join(
+ SCRIPT_DIR,
+ "../../out/NativeClientVSAddIn/")
-# Directory that contains the build assemblies
+# Directory containing static installer resources.
+RESOURCE_DIRECTORY = os.path.join(SCRIPT_DIR, "InstallerResources/")
+
+# Directory that contains the build assemblies.
ASSEMBLY_DIRECTORY = os.path.join(BUILD_OUTPUT_DIRECTORY, "Debug")
-# Base name of the final zip file
+# Base name of the final zip file.
OUTPUT_NAME = os.path.join(BUILD_OUTPUT_DIRECTORY, "NativeClientVSAddIn.zip")
-# List of paths to files to include in the zip file
+# List of source/destination pairs to include in zip file.
FILE_LIST = [
- os.path.join(RESOURCE_DIRECTORY, 'NativeClientVSAddIn.AddIn'),
- os.path.join(RESOURCE_DIRECTORY, 'install.py'),
- os.path.join(ASSEMBLY_DIRECTORY, 'NativeClientVSAddIn.dll')]
+ (os.path.join(ASSEMBLY_DIRECTORY, "NativeClientVSAddIn.dll"), ''),
+ (os.path.join(ASSEMBLY_DIRECTORY, "NaCl.Build.CPPTasks.dll"), 'NaCl')]
+
+
+def AddFolderToZip(path, zip_file):
+ """Adds an entire folder and sub folders to an open zipfile object.
+
+ The zip_file must already be open and it is not closed by this function.
+
+ Args:
+ path: Folder to add.
+ zipfile: Already open zip file.
+
+ Returns:
+ Nothing.
+ """
+ # Ensure the path ends in trailing slash.
+ path = path.rstrip("/\\") + "\\"
+ for dir_path, dir_names, files in os.walk(path):
+ for file in files:
+ read_path = os.path.join(dir_path, file)
+ zip_based_dir = dir_path[len(path):]
+ write_path = os.path.join(zip_based_dir, file)
+ zip_file.write(read_path, write_path, zipfile.ZIP_DEFLATED)
+
def main():
- # Zip the package
+ # Zip the package.
out_file = zipfile.ZipFile(OUTPUT_NAME, 'w')
- for file_path in FILE_LIST:
- out_file.write(file_path, os.path.basename(file_path), zipfile.ZIP_DEFLATED)
+ for source_dest in FILE_LIST:
+ file_name = os.path.basename(source_dest[0])
+ dest = os.path.join(source_dest[1], file_name)
+ out_file.write(source_dest[0], dest, zipfile.ZIP_DEFLATED)
+ AddFolderToZip(RESOURCE_DIRECTORY, out_file)
out_file.close()
+
if __name__ == '__main__':
main()
« no previous file with comments | « visual_studio/NativeClientVSAddIn/build.bat ('k') | visual_studio/NativeClientVSAddIn/developer_deploy.bat » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698