Some preparation work towards the gclient.py refactor.
Switch "" usage to '' to please Brad. Didn't change gclient.py yet because it
will conflict with the refactor.
TEST=unit tests still pass.
Review URL: http://codereview.chromium.org/2769011
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@49545 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_utils.py b/gclient_utils.py
index 276d015..327dfe4 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -42,7 +42,7 @@
Works on python 2.4
"""
- logging.debug("%s, cwd=%s" % (str(command), str(cwd)))
+ logging.debug('%s, cwd=%s' % (str(command), str(cwd)))
try:
stderr = None
if not print_error:
@@ -63,10 +63,10 @@
"""Splits url and returns a two-tuple: url, rev"""
if url.startswith('ssh:'):
# Make sure ssh://test@example.com/test.git@stable works
- regex = r"(ssh://(?:[\w]+@)?[-\w:\.]+/[-\w\./]+)(?:@(.+))?"
+ regex = r'(ssh://(?:[\w]+@)?[-\w:\.]+/[-\w\./]+)(?:@(.+))?'
components = re.search(regex, url).groups()
else:
- components = url.split("@")
+ components = url.split('@', 1)
if len(components) == 1:
components += [None]
return tuple(components)
@@ -160,7 +160,7 @@
return
if os.path.islink(file_path) or not os.path.isdir(file_path):
- raise Error("RemoveDirectory asked to remove non-directory %s" % file_path)
+ raise Error('RemoveDirectory asked to remove non-directory %s' % file_path)
has_win32api = False
if sys.platform == 'win32':
@@ -251,7 +251,7 @@
"""
logging.debug(command)
if print_messages:
- print("\n________ running \'%s\' in \'%s\'"
+ print('\n________ running \'%s\' in \'%s\''
% (' '.join(command), in_directory))
# *Sigh*: Windows needs shell=True, or else it won't search %PATH% for the
@@ -266,25 +266,25 @@
# normally buffering is done for each line, but if svn requests input, no
# end-of-line character is output after the prompt and it would not show up.
in_byte = kid.stdout.read(1)
- in_line = ""
+ in_line = ''
while in_byte:
- if in_byte != "\r":
+ if in_byte != '\r':
if print_stdout:
if not print_messages:
- print("\n________ running \'%s\' in \'%s\'"
+ print('\n________ running \'%s\' in \'%s\''
% (' '.join(command), in_directory))
print_messages = True
sys.stdout.write(in_byte)
- if in_byte != "\n":
+ if in_byte != '\n':
in_line += in_byte
- if in_byte == "\n" and filter_fn:
+ if in_byte == '\n' and filter_fn:
filter_fn(in_line)
- in_line = ""
+ in_line = ''
in_byte = kid.stdout.read(1)
rv = kid.wait()
if rv:
- msg = "failed to run command: %s" % " ".join(command)
+ msg = 'failed to run command: %s' % ' '.join(command)
if fail_status != None:
print >>sys.stderr, msg
@@ -346,7 +346,7 @@
config_path = FindFileUpwards(config_file, path)
if not config_path:
- print "Can't find", config_file
+ print "Can't find %s" % config_file
return None
env = {}