From beba27ed1ef0da66dcf2b640389bad3ef6e729d2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 31 Aug 2013 09:37:02 +0800 Subject: [PATCH] Create zip distribution for binaries on Windows. --- script/create-dist.py | 7 ++++--- script/lib/util.py | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/script/create-dist.py b/script/create-dist.py index 8e40919b..40d3854f 100755 --- a/script/create-dist.py +++ b/script/create-dist.py @@ -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(): diff --git a/script/lib/util.py b/script/lib/util.py index 5d4b8ba8..411bce8a 100644 --- a/script/lib/util.py +++ b/script/lib/util.py @@ -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: -- 2.43.0