[swtoolkit] r72 committed - Make the 7zip tool more flexible in handling different versions of 7zi...

5 views
Skip to first unread message

codesite...@google.com

unread,
Apr 12, 2011, 9:32:07 PM4/12/11
to swto...@googlegroups.com
Revision: 72
Author: bradn...@google.com
Date: Tue Apr 12 18:31:01 2011
Log: Make the 7zip tool more flexible in handling different versions
of 7zip.

BUG=None
TEST=None
R=rspa...@google.com
Review URL: http://codereview.chromium.org/6740010
http://code.google.com/p/swtoolkit/source/detail?r=72

Modified:
/trunk/site_scons/site_tools/seven_zip.py

=======================================
--- /trunk/site_scons/site_tools/seven_zip.py Mon Feb 9 11:18:10 2009
+++ /trunk/site_scons/site_tools/seven_zip.py Tue Apr 12 18:31:01 2011
@@ -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

Reply all
Reply to author
Forward
0 new messages