]> khamidou — GitHub mirrors - electron.git/commitdiff
Create zip distribution for binaries on Windows.
authorCheng Zhao <zcbenz@gmail.com>
Sat, 31 Aug 2013 01:37:02 +0000 (09:37 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Sat, 31 Aug 2013 01:37:23 +0000 (09:37 +0800)
script/create-dist.py
script/lib/util.py

index 8e40919bec2f26a180e97f4afdd8570762b73c4a..40d3854ff25a236680c36e5983cacea3c7919f58 100755 (executable)
@@ -129,13 +129,14 @@ def create_version():
 
 
 def create_zip():
-  print "Zipping distribution..."
   zip_file = os.path.join(SOURCE_ROOT, 'dist', 'atom-shell.zip')
   safe_unlink(zip_file)
 
   with scoped_cwd(DIST_DIR):
-    files = ['Atom.app', 'LICENSE', 'version']
-    subprocess.check_call(['zip', '-r', '-y', zip_file] + files)
+    files = TARGET_BINARIES[TARGET_PLATFORM] +  \
+            TARGET_DIRECTORIES[TARGET_PLATFORM] + \
+            ['LICENSE', 'version']
+    make_zip(zip_file, files)
 
 
 def create_header_tarball():
index 5d4b8ba8c59e9e26c1d9983ed14b3c34e056efba..411bce8a2f88991022127680579dfe42c116e434 100644 (file)
@@ -64,6 +64,16 @@ def extract_zip(zip_path, destination):
     with zipfile.ZipFile(zip_path) as z:
       z.extractall(destination)
 
+def make_zip(zip_file_path, files):
+  safe_unlink(zip_file_path)
+  if sys.platform == 'darwin':
+    subprocess.check_call(['zip', '-r', '-y', zip_file_path] + files)
+  else:
+    zip_file = zipfile.ZipFile(zip_file_path, "w")
+    for filename in files:
+      zip_file.write(filename, filename)
+    zip_file.close()
+
 
 def rm_rf(path):
   try: