|
|
|
@ -5,9 +5,9 @@
|
|
|
|
|
|
|
|
|
|
# TODO(hinoka): Use logging.
|
|
|
|
|
|
|
|
|
|
from __future__ import division
|
|
|
|
|
from __future__ import print_function
|
|
|
|
|
|
|
|
|
|
import cStringIO
|
|
|
|
|
import codecs
|
|
|
|
|
from contextlib import contextmanager
|
|
|
|
|
import copy
|
|
|
|
@ -18,19 +18,24 @@ import json
|
|
|
|
|
import optparse
|
|
|
|
|
import os
|
|
|
|
|
import pprint
|
|
|
|
|
import random
|
|
|
|
|
import re
|
|
|
|
|
import subprocess
|
|
|
|
|
import sys
|
|
|
|
|
import tempfile
|
|
|
|
|
import threading
|
|
|
|
|
import time
|
|
|
|
|
import urllib2
|
|
|
|
|
import urlparse
|
|
|
|
|
import uuid
|
|
|
|
|
|
|
|
|
|
import os.path as path
|
|
|
|
|
|
|
|
|
|
# TODO(crbug.com/1227140): Clean up when py2 is no longer supported.
|
|
|
|
|
try:
|
|
|
|
|
from cStringIO import StringIO
|
|
|
|
|
import urlparse
|
|
|
|
|
except ImportError: # pragma: no cover
|
|
|
|
|
from io import StringIO
|
|
|
|
|
import urllib.parse as urlparse
|
|
|
|
|
|
|
|
|
|
# How many bytes at a time to read from pipes.
|
|
|
|
|
BUF_SIZE = 256
|
|
|
|
|
|
|
|
|
@ -170,7 +175,7 @@ def call(*args, **kwargs): # pragma: no cover
|
|
|
|
|
stdin_data = kwargs.pop('stdin_data', None)
|
|
|
|
|
if stdin_data:
|
|
|
|
|
kwargs['stdin'] = subprocess.PIPE
|
|
|
|
|
out = cStringIO.StringIO()
|
|
|
|
|
out = StringIO()
|
|
|
|
|
new_env = kwargs.get('env', {})
|
|
|
|
|
env = os.environ.copy()
|
|
|
|
|
env.update(new_env)
|
|
|
|
@ -455,7 +460,7 @@ def create_manifest():
|
|
|
|
|
for path, info in json.load(f).items()
|
|
|
|
|
if info['rev'] is not None
|
|
|
|
|
}
|
|
|
|
|
except ValueError, SubprocessFailed:
|
|
|
|
|
except (ValueError, SubprocessFailed):
|
|
|
|
|
return {}
|
|
|
|
|
finally:
|
|
|
|
|
os.remove(fname)
|
|
|
|
@ -598,7 +603,7 @@ def _maybe_break_locks(checkout_path, tries=3):
|
|
|
|
|
print('FAILED to break lock: %s: %s' % (to_break, ex))
|
|
|
|
|
raise
|
|
|
|
|
|
|
|
|
|
for _ in xrange(tries):
|
|
|
|
|
for _ in range(tries):
|
|
|
|
|
try:
|
|
|
|
|
attempt()
|
|
|
|
|
return
|
|
|
|
|