diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-07-20 20:24:24 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-07-20 20:24:24 +0000 |
commit | d654241befc7e1610689b13c646bad24be956403 (patch) | |
tree | 9fa78419317cd67474fe9c8dee73ecc5ce3e1f2c | |
parent | 8a5f5efe6d0261d451f71ccc13c297c1a3fc9323 (diff) | |
download | portage-d654241befc7e1610689b13c646bad24be956403.tar.gz portage-d654241befc7e1610689b13c646bad24be956403.tar.bz2 portage-d654241befc7e1610689b13c646bad24be956403.zip |
Make portage.listdir() and dbapi.cp_list() return unicode.
svn path=/main/trunk/; revision=13839
-rw-r--r-- | pym/portage/__init__.py | 2 | ||||
-rw-r--r-- | pym/portage/dbapi/porttree.py | 2 | ||||
-rw-r--r-- | pym/portage/dbapi/vartree.py | 5 |
3 files changed, 8 insertions, 1 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index d78491c4d..3a969bbce 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -246,6 +246,8 @@ def cacheddir(my_original_path, ignorecvs, ignorelist, EmptyOnError, followSymli raise portage.exception.PermissionDenied(mypath) ftype = [] for x in list: + if not isinstance(x, unicode): + x = unicode(x, errors='replace') try: if followSymlinks: pathstat = os.stat(mypath+"/"+x) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index e29377f72..1fd593811 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -873,6 +873,8 @@ class portdbapi(dbapi): except OSError: continue for x in file_list: + if not isinstance(x, unicode): + x = unicode(x, errors='replace') pf = None if glep55: diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 486439718..d92bdf9ef 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -894,6 +894,8 @@ class vardbapi(dbapi): returnme = [] for x in dir_list: + if not isinstance(x, unicode): + x = unicode(x, errors='replace') if self._excluded_dirs.match(x) is not None: continue ps = pkgsplit(x) @@ -925,7 +927,8 @@ class vardbapi(dbapi): else: def listdir(p, **kwargs): try: - return [x for x in os.listdir(p) \ + return [isinstance(x, unicode) and x or \ + unicode(x, errors='replace') for x in os.listdir(p) \ if os.path.isdir(os.path.join(p, x))] except EnvironmentError, e: if e.errno == PermissionDenied.errno: |