Commit 51e84fba authored by maruel@chromium.org's avatar maruel@chromium.org

The previous fix r145315 seems to have broken python 2.6.2 on Windows users.

Since open() and codecs.open() have different behavior, and codecs.open()
misbehaves on python 2.6, switch to open() with manual str decoding.

TBR=cmp@chromium.org
BUG=
TEST=I failed to reproduce, it's a shot in the dark


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@145396 0039d316-1c4b-4281-b951-d872f2087c98
parent 8a066dc6
......@@ -77,12 +77,9 @@ class PrintableObject(object):
def FileRead(filename, mode='rU'):
with codecs.open(filename, mode=mode, encoding='utf-8') as f:
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
with open(filename, mode=mode) as f:
# codecs.open() has different behavior than open() on python 2.6.
return f.read().decode('utf-8')
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