From: Zac Medico Date: Thu, 13 Aug 2009 22:17:05 +0000 (-0000) Subject: Create portage._merge_encoding and a corresponding _os_merge wrapper that X-Git-Tag: v2.2_rc39~86 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=19caf9be975b650c6778a28432ccb11a9c429f84;p=portage.git Create portage._merge_encoding and a corresponding _os_merge wrapper that will later be used for all the merge code. svn path=/main/trunk/; revision=14019 --- diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 92aaea871..4f2bb4204 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -196,16 +196,22 @@ class _unicode_module_wrapper(object): result = _unicode_func_wrapper(result, encoding=encoding) return result -if sys.hexversion >= 0x3000000: - def _unicode_func_wrapper(func): - return func - def _unicode_module_wrapper(mod): - return mod +# TODO: Change this to sys.getfilesystemencoding() after all of +# the merge code has been updated to use _merge_encoding. +_merge_encoding = 'utf_8' + +import os as _os +_os_overrides = { + id(_os.fdopen) : _os.fdopen, + id(_os.read) : _os.read, +} + +os = _unicode_module_wrapper(_os, overrides=_os_overrides) +_os_merge = _unicode_module_wrapper(_os, + encoding=_merge_encoding, overrides=_os_overrides) -import os -os = _unicode_module_wrapper(os, overrides={id(os.read):os.read}) -import shutil -shutil = _unicode_module_wrapper(shutil) +import shutil as _shutil +shutil = _unicode_module_wrapper(_shutil) # Imports below this point rely on the above unicode wrapper definitions.