Use unzip command on Mac to keep symbol links in zip file work.

This commit is contained in:
Cheng Zhao 2013-06-21 10:32:57 +08:00
parent 2f50102b50
commit 1eb521d32a

View file

@ -3,6 +3,8 @@
import atexit import atexit
import errno import errno
import shutil import shutil
import subprocess
import sys
import tarfile import tarfile
import tempfile import tempfile
import urllib2 import urllib2
@ -44,8 +46,12 @@ def extract_tarball(tarball_path, member, destination):
def extract_zip(zip_path, destination): def extract_zip(zip_path, destination):
with zipfile.ZipFile(zip_path) as z: if sys.platform == 'darwin':
z.extractall(destination) # Use unzip command on Mac to keep symbol links in zip file work.
subprocess.check_call(['unzip', zip_path, '-d', destination])
else:
with zipfile.ZipFile(zip_path) as z:
z.extractall(destination)
def safe_unlink(path): def safe_unlink(path):