From 791b1bc23bf51f5706de80d2b4ce2236e0054cf3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 6 Aug 2009 08:25:23 +0000 Subject: Convert paths to unicode when working with CONTENTS. svn path=/main/trunk/; revision=13930 --- pym/portage/dbapi/vartree.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index c6374cdf9..52d48a70f 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1353,11 +1353,16 @@ class vardbapi(dbapi): if not hasattr(pkg, "getcontents"): pkg = self._dblink(pkg) root = self.root + if not isinstance(root, unicode): + root = unicode(root, encoding='utf_8', errors='replace') root_len = len(root) - 1 new_contents = pkg.getcontents().copy() removed = 0 for filename in paths: + if not isinstance(filename, unicode): + filename = unicode(filename, + encoding='utf_8', errors='replace') filename = normalize_path(filename) if relative_paths: relative_filename = filename @@ -2530,6 +2535,14 @@ class dblink(object): if the file is not owned by this package. """ + if not isinstance(filename, unicode): + filename = unicode(filename, + encoding='utf_8', errors='replace') + + if not isinstance(destroot, unicode): + destroot = unicode(destroot, + encoding='utf_8', errors='replace') + destfile = normalize_path( os.path.join(destroot, filename.lstrip(os.path.sep))) @@ -2712,6 +2725,8 @@ class dblink(object): new_contents = self.getcontents().copy() old_contents = self._installed_instance.getcontents() for f in sorted(preserve_paths): + if not isinstance(f, unicode): + f = unicode(f, encoding='utf_8', errors='replace') f_abs = os.path.join(root, f.lstrip(os.sep)) contents_entry = old_contents.get(f_abs) if contents_entry is None: @@ -3734,6 +3749,9 @@ class dblink(object): mydest = join(destroot, offset, x) # myrealdest is mydest without the $ROOT prefix (makes a difference if ROOT!="/") myrealdest = join(sep, offset, x) + if not isinstance(myrealdest, unicode): + myrealdest = unicode(myrealdest, + encoding='utf_8', errors='replace') # stat file once, test using S_* macros many times (faster that way) mystat = os.lstat(mysrc) mymode = mystat[stat.ST_MODE] -- cgit v1.2.3-1-g7c22