bin/chpathtool.py: fix py3.2 &py3.3 test failure
The magic module for those 2 python versions do not handle byte strings correctly.
forcing the filename to str() fixes it for all pythons tested.
diff --git a/bin/chpathtool.py b/bin/chpathtool.py
index 6460662..6ddf329 100755
--- a/bin/chpathtool.py
+++ b/bin/chpathtool.py
@@ -51,9 +51,12 @@
return self._call(filename)
def _is_text_magic(self, filename):
- mime_type = self._m.file(filename)
- if isinstance(mime_type, bytes):
- mime_type = mime_type.decode('ascii', 'replace')
+ # regression in sys-apps/file causes
+ # py 3.2 & 3.3 magic module to not handle bytes properly
+ if isinstance(filename, bytes):
+ mime_type = self._m.file(str(filename))
+ else:
+ mime_type = self._m.file(filename)
return mime_type.startswith('text/')
def _is_text_encoding(self, filename):