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

Unified Diff: tools/bisect-builds.py

Issue 2757333002: Use system command to unzip binaries from zip file on Mac OS (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/bisect-builds.py
diff --git a/tools/bisect-builds.py b/tools/bisect-builds.py
index 6d0830f8d29752c2790c4e878f3376e941b5c7f7..a87807e4d826a4662c4c5894d94b6a22ec848e07 100755
--- a/tools/bisect-builds.py
+++ b/tools/bisect-builds.py
@@ -452,16 +452,32 @@ class PathContext(object):
self.bad_revision)
return revlist
+
+def IsMac():
+ return sys.platform.startswith('darwin')
+
+
def UnzipFilenameToDir(filename, directory):
"""Unzip |filename| to |directory|."""
cwd = os.getcwd()
if not os.path.isabs(filename):
filename = os.path.join(cwd, filename)
- zf = zipfile.ZipFile(filename)
# Make base.
if not os.path.isdir(directory):
os.mkdir(directory)
os.chdir(directory)
+
+ # The Python ZipFile does not support symbolic links, which makes it
+ # unsuitable for Mac builds. so use ditto instead.
+ if IsMac():
+ unzip_cmd = ['ditto', '-x', '-k', filename, '.']
+ proc = subprocess.Popen(unzip_cmd, bufsize=0, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ proc.communicate()
+ os.chdir(cwd)
+ return
+
+ zf = zipfile.ZipFile(filename)
# Extract files.
for info in zf.infolist():
name = info.filename
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698