summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-14 06:41:08 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-14 06:41:08 +0000
commite0d28a7606a94d38b34ef0599e1f5519cfe3ed1f (patch)
treebe635b0df2de50606664f6cc834949171f1259d9
parentef776177fb25bdade22637fa8ae50e0bdf6dbe14 (diff)
downloadportage-e0d28a7606a94d38b34ef0599e1f5519cfe3ed1f.tar.gz
portage-e0d28a7606a94d38b34ef0599e1f5519cfe3ed1f.tar.bz2
portage-e0d28a7606a94d38b34ef0599e1f5519cfe3ed1f.zip
Add an 'encoding' parameter to movefile(), so that we can make it obey
sys.getfilesystemencoding() when called for merge/unmerge. svn path=/main/trunk/; revision=14024
-rw-r--r--pym/portage/__init__.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 46cfb9190..76bfcbc44 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -216,7 +216,8 @@ shutil = _unicode_module_wrapper(_shutil)
# Imports below this point rely on the above unicode wrapper definitions.
try:
- import portage._selinux as selinux
+ import portage._selinux
+ selinux = _unicode_module_wrapper(_selinux)
except OSError, e:
sys.stderr.write("!!! SELinux not loaded: %s\n" % str(e))
del e
@@ -7029,16 +7030,25 @@ def _movefile(src, dest, **kwargs):
"mv '%s' '%s'" % (src, dest))
def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
- hardlink_candidates=None):
+ hardlink_candidates=None, encoding='utf_8'):
"""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."""
#print "movefile("+str(src)+","+str(dest)+","+str(newmtime)+","+str(sstat)+")"
- global lchown
+
if mysettings is None:
global settings
mysettings = settings
+
selinux_enabled = mysettings.selinux_enabled()
+ if selinux_enabled:
+ selinux = _unicode_module_wrapper(_selinux, encoding=encoding)
+
+ lchown = _unicode_func_wrapper(data.lchown, encoding=encoding)
+ os = _unicode_module_wrapper(_os,
+ encoding=encoding, overrides=_os_overrides)
+ shutil = _unicode_module_wrapper(_shutil, encoding=encoding)
+
try:
if not sstat:
sstat=os.lstat(src)