From: "Brian Dolbec" <brian.dolbec@gmail.com> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/portage:v2.2.11 commit in: bin/ Date: Sun, 3 Aug 2014 15:24:35 +0000 (UTC) [thread overview] Message-ID: <1407079165.9351edad48523bb38b1bf651506786bdc8814f62.dol-sen@gentoo> (raw) 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):
WARNING: multiple messages have this Message-ID (diff)
From: "Brian Dolbec" <brian.dolbec@gmail.com> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/portage:master commit in: bin/ Date: Sun, 3 Aug 2014 15:22:59 +0000 (UTC) [thread overview] Message-ID: <1407079165.9351edad48523bb38b1bf651506786bdc8814f62.dol-sen@gentoo> (raw) Message-ID: <20140803152259.rfOY_di1BfCgEkgjCvVW5sT0I-1zXWf7bgqRvRGU2zA@z> (raw) 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):
next reply other threads:[~2014-08-03 15:24 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-08-03 15:24 Brian Dolbec [this message] 2014-08-03 15:22 ` [gentoo-commits] proj/portage:master commit in: bin/ Brian Dolbec
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1407079165.9351edad48523bb38b1bf651506786bdc8814f62.dol-sen@gentoo \ --to=brian.dolbec@gmail.com \ --cc=gentoo-commits@lists.gentoo.org \ --cc=gentoo-dev@lists.gentoo.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox