parse_desktop_entry: fix python3 bug #429544
authorZac Medico <zmedico@gentoo.org>
Thu, 2 Aug 2012 19:55:09 +0000 (12:55 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 2 Aug 2012 19:55:09 +0000 (12:55 -0700)
pym/portage/util/_desktop_entry.py

index 790178013769833409645a314ad782ad47376c64..8c760c0435de9791b06c1420de8a915c82a4f4ce 100644 (file)
@@ -31,7 +31,11 @@ def parse_desktop_entry(path):
                encoding=_encodings['fs'], errors='strict'),
                mode='r', encoding=_encodings['repo.content'],
                errors='replace') as f:
-               read_file(f)
+               content = f.read()
+
+       # In Python 3.2, read_file does not support bytes in file names
+       # (see bug #429544), so use StringIO to hide the file name.
+       read_file(io.StringIO(content))
 
        return parser