Commit 8a066dc6 authored by maruel@chromium.org's avatar maruel@chromium.org

Fix difference on behavior on python 2.6 on linux with open(mode='rU').

TBR=cmp@chromium.org
BUG=
TEST=manually tested gclient sync works on linux with python 2.6


Review URL: https://chromiumcodereview.appspot.com/10694069

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@145315 0039d316-1c4b-4281-b951-d872f2087c98
parent dae209fb
......@@ -78,7 +78,11 @@ class PrintableObject(object):
def FileRead(filename, mode='rU'):
with codecs.open(filename, mode=mode, encoding='utf-8') as f:
return f.read()
content = f.read()
if mode.endswith('U'):
# codecs.open() has different behavior than open() on python 2.6.
return content.replace('\r\n', '\n')
return content
def FileWrite(filename, content, mode='w'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment