Fix presubmit errors in toolchain2013, so that cq works for depot_tools.

No functionality change.

TBR=scottmg@chromium.org

Review URL: https://codereview.chromium.org/136793018

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@245073 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
thakis@chromium.org 12 years ago
parent 7cc7a1c5dc
commit 9eabb22cc8

@ -37,7 +37,6 @@ def TempDir():
"""Generates a temporary directory (for downloading or extracting to) and keep """Generates a temporary directory (for downloading or extracting to) and keep
track of the directory that's created for cleaning up later. track of the directory that's created for cleaning up later.
""" """
global g_temp_dirs
temp = tempfile.mkdtemp() temp = tempfile.mkdtemp()
g_temp_dirs.append(temp) g_temp_dirs.append(temp)
return temp return temp
@ -77,13 +76,13 @@ def Download(url, local_path):
content_length = int(req.headers.get('Content-Length', 0)) content_length = int(req.headers.get('Content-Length', 0))
bytes_read = 0L bytes_read = 0L
terminator = '\r' if sys.stdout.isatty() else '\n' terminator = '\r' if sys.stdout.isatty() else '\n'
with open(local_path, 'wb') as file: with open(local_path, 'wb') as file_handle:
while True: while True:
chunk = req.read(1024 * 1024) chunk = req.read(1024 * 1024)
if not chunk: if not chunk:
break break
bytes_read += len(chunk) bytes_read += len(chunk)
file.write(chunk) file_handle.write(chunk)
sys.stdout.write('... %d/%d%s' % (bytes_read, content_length, terminator)) sys.stdout.write('... %d/%d%s' % (bytes_read, content_length, terminator))
sys.stdout.flush() sys.stdout.flush()
sys.stdout.write('\n') sys.stdout.write('\n')
@ -181,7 +180,7 @@ def CopyToFinalLocation(extracted_dirs, target_dir):
} }
matches = [] matches = []
for extracted_dir in extracted_dirs: for extracted_dir in extracted_dirs:
for root, dirnames, filenames in os.walk(extracted_dir): for root, _, filenames in os.walk(extracted_dir):
for filename in filenames: for filename in filenames:
matches.append((extracted_dir, os.path.join(root, filename))) matches.append((extracted_dir, os.path.join(root, filename)))
@ -265,7 +264,7 @@ def main():
help='use downloaded files from DIR') help='use downloaded files from DIR')
parser.add_option('--express', parser.add_option('--express',
help='use VS Express instead of Pro', action='store_true') help='use VS Express instead of Pro', action='store_true')
options, args = parser.parse_args() options, _ = parser.parse_args()
try: try:
target_dir = os.path.abspath(options.targetdir) target_dir = os.path.abspath(options.targetdir)
if os.path.exists(target_dir): if os.path.exists(target_dir):

Loading…
Cancel
Save