aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Varner <fuzzyray@gentoo.org>2017-09-06 13:25:39 -0500
committerPaul Varner <fuzzyray@gentoo.org>2017-09-06 13:25:39 -0500
commit308e33dc9e0cba958a583d86799dcb660ba39cb1 (patch)
tree697938bb714c6cbde8d3d848a65e0b6a6ce2e0fb
parentequery: check: use os.path.lexists() (diff)
downloadgentoolkit-308e33dc9e0cba958a583d86799dcb660ba39cb1.tar.gz
gentoolkit-308e33dc9e0cba958a583d86799dcb660ba39cb1.tar.bz2
gentoolkit-308e33dc9e0cba958a583d86799dcb660ba39cb1.zip
equery: size: Fix UnicodeDecodeError
Encode the filename before calling os.lstat X-Gentoo-Bug: 531636 X-Gentoo-Bug-URL: https://bugs.gentoo.org/531636
-rw-r--r--pym/gentoolkit/package.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/pym/gentoolkit/package.py b/pym/gentoolkit/package.py
index 42b632b..149ca74 100644
--- a/pym/gentoolkit/package.py
+++ b/pym/gentoolkit/package.py
@@ -46,6 +46,7 @@ from string import Template
import portage
from portage.util import LazyItemsDict
+from portage import _encodings, _unicode_decode, _unicode_encode
import gentoolkit.pprinter as pp
from gentoolkit import errors
@@ -380,7 +381,7 @@ class Package(CPV):
size = n_files = n_uncounted = 0
for path in self.parsed_contents(prefix_root=True):
try:
- st = os.lstat(path)
+ st = os.lstat(_unicode_encode(path, encoding=_encodings['fs']))
except OSError:
continue