public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: bin/
  2014-08-03 15:24 [gentoo-commits] proj/portage:v2.2.11 commit in: bin/ Brian Dolbec
@ 2014-08-03 15:22 ` Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2014-08-03 15:22 UTC (permalink / raw
  To: gentoo-commits

commit:     9351edad48523bb38b1bf651506786bdc8814f62
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Aug  3 15:08:18 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug  3 15:19:25 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9351edad

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.

---
 bin/chpathtool.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

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 @@ class IsTextFile(object):
 		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):


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/portage:v2.2.11 commit in: bin/
@ 2014-08-03 15:24 Brian Dolbec
  2014-08-03 15:22 ` [gentoo-commits] proj/portage:master " Brian Dolbec
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Dolbec @ 2014-08-03 15:24 UTC (permalink / raw
  To: gentoo-commits

commit:     9351edad48523bb38b1bf651506786bdc8814f62
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Aug  3 15:08:18 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Aug  3 15:19:25 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9351edad

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.

---
 bin/chpathtool.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

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 @@ class IsTextFile(object):
 		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):


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-03 15:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-03 15:24 [gentoo-commits] proj/portage:v2.2.11 commit in: bin/ Brian Dolbec
2014-08-03 15:22 ` [gentoo-commits] proj/portage:master " Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox