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

Unified Diff: site_scons/site_tools/seven_zip.py

Issue 6740010: Make the 7zip tool more flexible in handling different versions of 7zip. (Closed) Base URL: http://swtoolkit.googlecode.com/svn/trunk/
Patch Set: Created 9 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: site_scons/site_tools/seven_zip.py
===================================================================
--- site_scons/site_tools/seven_zip.py (revision 71)
+++ site_scons/site_tools/seven_zip.py (working copy)
@@ -33,6 +33,7 @@
import os
+import re
import shutil
import subprocess
import tempfile
@@ -54,9 +55,10 @@
cmd = env.subst('$SEVEN_ZIP l "%s"' % source)
# Run it and capture output.
output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
- # Strip off 7-line header and 3-line trailer from 7zip output.
- lines = output.split('\r\n')[7:-3]
- # Trim out just the files and their names.
+ # Remove header + footer.
+ m = re.match('.*[-]{8}[^\n]*\n(.*)\r\n[-]{8}.*', output, re.DOTALL)
+ lines = m.group(1).split('\r\n')
+ # Trim out just the files and their names (skip directories).
files = [i[53:] for i in lines if i[20] != 'D']
return files
« 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