Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Side by Side Diff: Tools/Scripts/webkitpy/common/system/filesystem.py

Issue 32663002: Remove _unit_test_config hack, instead use FileSystem() in cpp.py & cpp_unittest.py (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed unneccessary import of codecs Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Tools/Scripts/webkitpy/style/checkers/cpp.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 f.write(contents) 199 f.write(contents)
200 200
201 def open_text_file_for_reading(self, path): 201 def open_text_file_for_reading(self, path):
202 # Note: There appears to be an issue with the returned file objects 202 # Note: There appears to be an issue with the returned file objects
203 # not being seekable. See http://stackoverflow.com/questions/1510188/can -seek-and-tell-work-with-utf-8-encoded-documents-in-python . 203 # not being seekable. See http://stackoverflow.com/questions/1510188/can -seek-and-tell-work-with-utf-8-encoded-documents-in-python .
204 return codecs.open(path, 'r', 'utf8') 204 return codecs.open(path, 'r', 'utf8')
205 205
206 def open_text_file_for_writing(self, path): 206 def open_text_file_for_writing(self, path):
207 return codecs.open(path, 'w', 'utf8') 207 return codecs.open(path, 'w', 'utf8')
208 208
209 def read_text_file(self, path): 209 def read_text_file(self, path, errors='strict'):
Dirk Pranke 2013/10/22 19:17:03 Are you sure we need this? I.e., does test-webkitp
210 """Return the contents of the file at the given path as a Unicode string . 210 """Return the contents of the file at the given path as a Unicode string .
211 211
212 The file is read assuming it is a UTF-8 encoded file with no BOM.""" 212 The file is read assuming it is a UTF-8 encoded file with no BOM."""
213 with codecs.open(path, 'r', 'utf8') as f: 213 with codecs.open(path, 'r', 'utf8', errors) as f:
214 return f.read() 214 return f.read()
215 215
216 def write_text_file(self, path, contents): 216 def write_text_file(self, path, contents):
217 """Write the contents to the file at the given location. 217 """Write the contents to the file at the given location.
218 218
219 The file is written encoded as UTF-8 with no BOM.""" 219 The file is written encoded as UTF-8 with no BOM."""
220 with codecs.open(path, 'w', 'utf8') as f: 220 with codecs.open(path, 'w', 'utf8') as f:
221 f.write(contents) 221 f.write(contents)
222 222
223 def sha1(self, path): 223 def sha1(self, path):
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 def copytree(self, source, destination): 260 def copytree(self, source, destination):
261 shutil.copytree(source, destination) 261 shutil.copytree(source, destination)
262 262
263 def split(self, path): 263 def split(self, path):
264 """Return (dirname, basename + '.' + ext)""" 264 """Return (dirname, basename + '.' + ext)"""
265 return os.path.split(path) 265 return os.path.split(path)
266 266
267 def splitext(self, path): 267 def splitext(self, path):
268 """Return (dirname + os.sep + basename, '.' + ext)""" 268 """Return (dirname + os.sep + basename, '.' + ext)"""
269 return os.path.splitext(path) 269 return os.path.splitext(path)
OLDNEW
« no previous file with comments | « no previous file | Tools/Scripts/webkitpy/style/checkers/cpp.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698