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

Side by Side Diff: fix_encoding.py

Issue 6791018: Add a warning if the current version of python is not 2.5 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Updated to work seamlessly with python 2.5 Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « drover.py ('k') | gcl.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) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Collection of functions and classes to fix various encoding problems on 5 """Collection of functions and classes to fix various encoding problems on
6 multiple platforms with python. 6 multiple platforms with python.
7 """ 7 """
8 8
9 import codecs 9 import codecs
10 import locale 10 import locale
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 Understands how to use the win32 console API. 180 Understands how to use the win32 console API.
181 """ 181 """
182 def __init__(self, console_handle, fileno, stream_name, encoding): 182 def __init__(self, console_handle, fileno, stream_name, encoding):
183 super(WinUnicodeConsoleOutput, self).__init__( 183 super(WinUnicodeConsoleOutput, self).__init__(
184 fileno, '<Unicode console %s>' % stream_name, encoding) 184 fileno, '<Unicode console %s>' % stream_name, encoding)
185 # Handle to use for WriteConsoleW 185 # Handle to use for WriteConsoleW
186 self._console_handle = console_handle 186 self._console_handle = console_handle
187 187
188 # Loads the necessary function. 188 # Loads the necessary function.
189 from ctypes import byref, GetLastError, POINTER, windll, WINFUNCTYPE 189 from ctypes import byref, GetLastError, POINTER, windll, WINFUNCTYPE
190 from ctypes.wintypes import BOOL, DWORD, HANDLE, LPVOID, LPWSTR 190 from ctypes.wintypes import BOOL, DWORD, HANDLE, LPWSTR
191 from ctypes.wintypes import LPVOID # pylint: disable=E0611
191 192
192 self._DWORD = DWORD 193 self._DWORD = DWORD
193 self._byref = byref 194 self._byref = byref
194 195
195 # <http://msdn.microsoft.com/en-us/library/ms687401.aspx> 196 # <http://msdn.microsoft.com/en-us/library/ms687401.aspx>
196 self._WriteConsoleW = WINFUNCTYPE( 197 self._WriteConsoleW = WINFUNCTYPE(
197 BOOL, HANDLE, LPWSTR, DWORD, POINTER(DWORD), LPVOID)( 198 BOOL, HANDLE, LPWSTR, DWORD, POINTER(DWORD), LPVOID)(
198 ('WriteConsoleW', windll.kernel32)) 199 ('WriteConsoleW', windll.kernel32))
199 self._GetLastError = GetLastError 200 self._GetLastError = GetLastError
200 201
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 if sys.platform == 'win32': 354 if sys.platform == 'win32':
354 ret &= fix_win_codec() 355 ret &= fix_win_codec()
355 356
356 ret &= fix_default_encoding() 357 ret &= fix_default_encoding()
357 358
358 if sys.platform == 'win32': 359 if sys.platform == 'win32':
359 encoding = sys.getdefaultencoding() 360 encoding = sys.getdefaultencoding()
360 ret &= fix_win_sys_argv(encoding) 361 ret &= fix_win_sys_argv(encoding)
361 ret &= fix_win_console(encoding) 362 ret &= fix_win_console(encoding)
362 return ret 363 return ret
OLDNEW
« no previous file with comments | « drover.py ('k') | gcl.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698