summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-13 22:17:05 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-13 22:17:05 +0000
commit19caf9be975b650c6778a28432ccb11a9c429f84 (patch)
treea54bd5d0c8823a56e84817924230cc9d575d9e42
parent09e4e5ac8595257981aa91bff04c4ac4d0bb2138 (diff)
downloadportage-19caf9be975b650c6778a28432ccb11a9c429f84.tar.gz
portage-19caf9be975b650c6778a28432ccb11a9c429f84.tar.bz2
portage-19caf9be975b650c6778a28432ccb11a9c429f84.zip
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
-rw-r--r--pym/portage/__init__.py24
1 files changed, 15 insertions, 9 deletions
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.