summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-14 23:04:05 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-14 23:04:05 +0000
commit1692fbaa882e81ba6e4c5d6622876b923c050f1d (patch)
tree9045f8e63496074da2454aa4661ffdbf23b31247
parent92136a3820029b7060fea0dfd0f37497685acd1f (diff)
downloadportage-1692fbaa882e81ba6e4c5d6622876b923c050f1d.tar.gz
portage-1692fbaa882e81ba6e4c5d6622876b923c050f1d.tar.bz2
portage-1692fbaa882e81ba6e4c5d6622876b923c050f1d.zip
Use portage._fs_encoding where applicable.
svn path=/main/trunk/; revision=14053
-rw-r--r--pym/portage/__init__.py9
-rw-r--r--pym/portage/dbapi/vartree.py3
2 files changed, 7 insertions, 5 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 9d2c03317..4ce64eaa5 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -209,12 +209,13 @@ _os_overrides = {
id(_os.system) : _os.system,
}
-os = _unicode_module_wrapper(_os, overrides=_os_overrides)
+os = _unicode_module_wrapper(_os, overrides=_os_overrides,
+ encoding=_fs_encoding)
_os_merge = _unicode_module_wrapper(_os,
encoding=_merge_encoding, overrides=_os_overrides)
import shutil as _shutil
-shutil = _unicode_module_wrapper(_shutil)
+shutil = _unicode_module_wrapper(_shutil, encoding=_fs_encoding)
# Imports below this point rely on the above unicode wrapper definitions.
_selinux = None
@@ -222,7 +223,7 @@ selinux = None
_selinux_merge = _unicode_module_wrapper(_selinux, encoding=_merge_encoding)
try:
import portage._selinux
- selinux = _unicode_module_wrapper(_selinux)
+ selinux = _unicode_module_wrapper(_selinux, encoding=_fs_encoding)
except OSError, e:
sys.stderr.write("!!! SELinux not loaded: %s\n" % str(e))
del e
@@ -7111,7 +7112,7 @@ def _movefile(src, dest, **kwargs):
"mv '%s' '%s'" % (src, dest))
def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
- hardlink_candidates=None, encoding='utf_8'):
+ hardlink_candidates=None, encoding=_fs_encoding):
"""moves a file from src to dest, preserving all permissions and attributes; mtime will
be preserved even when moving across filesystems. Returns true on success and false on
failure. Move is atomic."""
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index b42e1c6ea..6729e41e7 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -37,6 +37,7 @@ from portage import listdir, dep_expand, digraph, flatten, key_expand, \
# This is a special version of the os module, wrapped for unicode support.
from portage import os
+from portage import _fs_encoding
from portage import _merge_encoding
from portage import _os_merge
from portage import _selinux_merge
@@ -2385,7 +2386,7 @@ class dblink(object):
# different value of sys.getfilesystemencoding(),
# so fall back to utf_8 if appropriate.
try:
- _unicode_encode(obj, encoding='utf_8', errors='strict')
+ _unicode_encode(obj, encoding=_fs_encoding, errors='strict')
except UnicodeEncodeError:
pass
else: