From owner-svn-ports-head@freebsd.org Tue Oct 1 05:27:21 2019 Return-Path: Delivered-To: svn-ports-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65977147176; Tue, 1 Oct 2019 05:27:21 +0000 (UTC) (envelope-from koobs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46j77Y1sn3z4Gmj; Tue, 1 Oct 2019 05:27:21 +0000 (UTC) (envelope-from koobs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FE80E939; Tue, 1 Oct 2019 05:27:21 +0000 (UTC) (envelope-from koobs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x915RK6t002813; Tue, 1 Oct 2019 05:27:20 GMT (envelope-from koobs@FreeBSD.org) Received: (from koobs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x915RKEu002811; Tue, 1 Oct 2019 05:27:20 GMT (envelope-from koobs@FreeBSD.org) Message-Id: <201910010527.x915RKEu002811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: koobs set sender to koobs@FreeBSD.org using -f From: Kubilay Kocak Date: Tue, 1 Oct 2019 05:27:20 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r513453 - in head/irc/py-limnoria: . files X-SVN-Group: ports-head X-SVN-Commit-Author: koobs X-SVN-Commit-Paths: in head/irc/py-limnoria: . files X-SVN-Commit-Revision: 513453 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Oct 2019 05:27:21 -0000 Author: koobs Date: Tue Oct 1 05:27:20 2019 New Revision: 513453 URL: https://svnweb.freebsd.org/changeset/ports/513453 Log: irc/py-limnoria: Update to 2019.09.08 - Rebase patch against the upstream PR Modified: head/irc/py-limnoria/Makefile head/irc/py-limnoria/distinfo head/irc/py-limnoria/files/patch-plugins_Web_plugin.py Modified: head/irc/py-limnoria/Makefile ============================================================================== --- head/irc/py-limnoria/Makefile Tue Oct 1 04:46:24 2019 (r513452) +++ head/irc/py-limnoria/Makefile Tue Oct 1 05:27:20 2019 (r513453) @@ -2,8 +2,7 @@ # $FreeBSD$ PORTNAME= limnoria -PORTVERSION= 2018.09.09 -PORTREVISION= 2 +PORTVERSION= 2019.09.08 CATEGORIES= irc python PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -25,7 +24,7 @@ USE_PYTHON= autoplist concurrent distutils GH_ACCOUNT= ProgVal GH_PROJECT= Limnoria -GH_TAGNAME= master-2018-09-10 +GH_TAGNAME= master-2019-09-08 OPTIONS_DEFINE= ECDSA PROXY OPTIONS_DEFAULT= ECDSA ENCODING RSS TIME Modified: head/irc/py-limnoria/distinfo ============================================================================== --- head/irc/py-limnoria/distinfo Tue Oct 1 04:46:24 2019 (r513452) +++ head/irc/py-limnoria/distinfo Tue Oct 1 05:27:20 2019 (r513453) @@ -1,3 +1,3 @@ -TIMESTAMP = 1538799817 -SHA256 (ProgVal-Limnoria-2018.09.09-master-2018-09-10_GH0.tar.gz) = 66af1f9bf02ae8a614451445efdcd5c782cc9881a3775de1f74d748c65626a6d -SIZE (ProgVal-Limnoria-2018.09.09-master-2018-09-10_GH0.tar.gz) = 963326 +TIMESTAMP = 1569902980 +SHA256 (ProgVal-Limnoria-2019.09.08-master-2019-09-08_GH0.tar.gz) = e7b8dec6befa6381d6f1ce75c240e132a0c020bbef15bb0e7b943a01d6790875 +SIZE (ProgVal-Limnoria-2019.09.08-master-2019-09-08_GH0.tar.gz) = 966922 Modified: head/irc/py-limnoria/files/patch-plugins_Web_plugin.py ============================================================================== --- head/irc/py-limnoria/files/patch-plugins_Web_plugin.py Tue Oct 1 04:46:24 2019 (r513452) +++ head/irc/py-limnoria/files/patch-plugins_Web_plugin.py Tue Oct 1 05:27:20 2019 (r513453) @@ -2,44 +2,51 @@ # https://github.com/ProgVal/Limnoria/issues/1362 # https://github.com/ProgVal/Limnoria/issues/1359 ---- plugins/Web/plugin.py.orig 2019-09-29 03:00:58 UTC +From 7cf91ad703ab324e38c37fa2976626505f1d569a Mon Sep 17 00:00:00 2001 +From: Rodrigo +Date: Fri, 27 Sep 2019 01:48:36 -0300 +Subject: [PATCH 1/3] make clear in logs about charade dep|make behave the same + way in py3 or py2 without errors in any case (e.g. without charade installed) + +--- + plugins/Web/plugin.py | 44 +++++++++++++++++-------------------------- + 1 file changed, 17 insertions(+), 27 deletions(-) + +diff --git plugins/Web/plugin.py plugins/Web/plugin.py +index 1ac362714..0bdb68a4a 100644 +--- plugins/Web/plugin.py +++ plugins/Web/plugin.py -@@ -149,32 +149,31 @@ class Web(callbacks.PluginRegexp): - def getTitle(self, irc, url, raiseErrors): +@@ -150,37 +150,27 @@ def getTitle(self, irc, url, raiseErrors): size = conf.supybot.protocols.http.peekSize() timeout = self.registryValue('timeout') -- (target, text) = utils.web.getUrlTargetAndContent(url, size=size, + (target, text) = utils.web.getUrlTargetAndContent(url, size=size, - timeout=timeout) - try: +- try: - text = text.decode(utils.web.getEncoding(text) or 'utf8', - 'replace') - except UnicodeDecodeError: - pass -- parser = Title() - if minisix.PY3 and isinstance(text, bytes): - if raiseErrors: - irc.error(_('Could not guess the page\'s encoding. (Try ' - 'installing python-charade.)'), Raise=True) -+ (target, text) = utils.web.getUrlTargetAndContent(url, size=size,timeout=timeout) -+ encoding = utils.web.getEncoding(text) -+ if encoding is None: # Condition if charade not installed -+ self.log.info('Web plugin TitleSnarfer: Could not guess the page\'s' -+ ' encoding. (Try installing python-charade.)') -+ encoding = 'utf-8' # Assume UTF-8 and replace unknown chars to the UTF-8 codec for U+FFFD in the next hop -+ text = text.decode(utils.web.getEncoding(text) or 'utf-8','replace') -+ parser = Title() -+ try: -+ parser.feed(text) -+ except: -+ parser = Title() -+ parser.feed(bytes(text)) # Explicitly pack to bytes in encoding errors for (more) python2 compatibility -+ parser.close() -+ title = utils.str.normalizeWhitespace(''.join(parser.data).strip()) -+ if title: -+ return (target, title) - else: +- else: - return None -- parser.feed(text) ++ timeout=timeout) ++ encoding = utils.web.getEncoding(text) ++ if encoding is None: # Condition if charade not installed ++ self.log.info('Web plugin TitleSnarfer: Could not guess the page\'s' ++ ' encoding. (Try installing python-charade.)') ++ encoding = 'utf-8' # Assume UTF-8 and replace unknown chars to the UTF-8 codec for U+FFFD in the next hop + try: ++ text = text.decode(utils.web.getEncoding(text) or 'utf-8', 'replace') + parser = Title() + parser.feed(text) +- except UnicodeDecodeError: +- # Workaround for Python 2 +- # https://github.com/ProgVal/Limnoria/issues/1359 +- parser = Title() +- parser.feed(text.encode('utf8')) - parser.close() - title = utils.str.normalizeWhitespace(''.join(parser.data).strip()) - if title: @@ -48,10 +55,120 @@ - if len(text) < size: - irc.error(_('That URL appears to have no HTML title.'), - Raise=True) -- else: ++ parser.close() ++ title = utils.str.normalizeWhitespace(''.join(parser.data).strip()) ++ if title: ++ return (target, title) + else: - irc.error(format(_('That URL appears to have no HTML title ' - 'within the first %S.'), size), Raise=True) + if len(text) < size: ++ self.log.info('Web plugin TitleSnarfer: ' ++ 'That URL appears to have no HTML title.') ++ except raiseErrors: # Can use raiseErrors here ? ++ irc.error(_('Web plugin TitleSnarfer encoding errors'), ++ Raise=True) + + @fetch_sandbox + def titleSnarfer(self, irc, msg, match): + +From 16247c5caf59f307b3d6910e31832fe30d0d583a Mon Sep 17 00:00:00 2001 +From: Rodrigo +Date: Fri, 27 Sep 2019 20:12:00 -0300 +Subject: [PATCH 2/3] more python2 compatibility + +--- + plugins/Web/plugin.py | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git plugins/Web/plugin.py plugins/Web/plugin.py +index 0bdb68a4a..85c129de3 100644 +--- plugins/Web/plugin.py ++++ plugins/Web/plugin.py +@@ -150,16 +150,20 @@ def getTitle(self, irc, url, raiseErrors): + size = conf.supybot.protocols.http.peekSize() + timeout = self.registryValue('timeout') + (target, text) = utils.web.getUrlTargetAndContent(url, size=size, +- timeout=timeout) ++ timeout=timeout) + encoding = utils.web.getEncoding(text) +- if encoding is None: # Condition if charade not installed ++ if encoding is None: # Condition if charade not installed + self.log.info('Web plugin TitleSnarfer: Could not guess the page\'s' + ' encoding. (Try installing python-charade.)') +- encoding = 'utf-8' # Assume UTF-8 and replace unknown chars to the UTF-8 codec for U+FFFD in the next hop ++ encoding = 'utf-8' # Assume UTF-8 and replace unknown chars to the UTF-8 codec for U+FFFD in the next hop + try: +- text = text.decode(utils.web.getEncoding(text) or 'utf-8', 'replace') ++ text = text.decode(utils.web.getEncoding(text) or 'utf-8','replace') + parser = Title() +- parser.feed(text) ++ try: ++ parser.feed(text) ++ except: ++ parser = Title() ++ parser.feed(bytes(text)) # Explicitly pack to bytes in encoding errors for (more) python2 compatibility + parser.close() + title = utils.str.normalizeWhitespace(''.join(parser.data).strip()) + if title: +@@ -168,9 +172,9 @@ def getTitle(self, irc, url, raiseErrors): + if len(text) < size: + self.log.info('Web plugin TitleSnarfer: ' + 'That URL appears to have no HTML title.') +- except raiseErrors: # Can use raiseErrors here ? ++ except: + irc.error(_('Web plugin TitleSnarfer encoding errors'), +- Raise=True) ++ Raise=True) + + @fetch_sandbox + def titleSnarfer(self, irc, msg, match): + +From 5cac4a3cbda26186a330709901da2633914de415 Mon Sep 17 00:00:00 2001 +From: Rodrigo +Date: Sat, 28 Sep 2019 23:40:44 -0300 +Subject: [PATCH 3/3] Include '(target, text) = + utils.web.getUrlTargetAndContent(url, size=size,timeout=timeout)' in + try/catch block to avoid thread blocking | send http errors to log + +--- + plugins/Web/plugin.py | 23 +++++++++++------------ + 1 file changed, 11 insertions(+), 12 deletions(-) + +diff --git plugins/Web/plugin.py plugins/Web/plugin.py +index 85c129de3..e67944f29 100644 +--- plugins/Web/plugin.py ++++ plugins/Web/plugin.py +@@ -149,14 +149,13 @@ def noIgnore(self, irc, msg): + def getTitle(self, irc, url, raiseErrors): + size = conf.supybot.protocols.http.peekSize() + timeout = self.registryValue('timeout') +- (target, text) = utils.web.getUrlTargetAndContent(url, size=size, +- timeout=timeout) +- encoding = utils.web.getEncoding(text) +- if encoding is None: # Condition if charade not installed +- self.log.info('Web plugin TitleSnarfer: Could not guess the page\'s' +- ' encoding. (Try installing python-charade.)') +- encoding = 'utf-8' # Assume UTF-8 and replace unknown chars to the UTF-8 codec for U+FFFD in the next hop + try: ++ (target, text) = utils.web.getUrlTargetAndContent(url, size=size,timeout=timeout) ++ encoding = utils.web.getEncoding(text) ++ if encoding is None: # Condition if charade not installed ++ self.log.info('Web plugin TitleSnarfer: Could not guess the page\'s' ++ ' encoding. (Try installing python-charade.)') ++ encoding = 'utf-8' # Assume UTF-8 and replace unknown chars to the UTF-8 codec for U+FFFD in the next hop + text = text.decode(utils.web.getEncoding(text) or 'utf-8','replace') + parser = Title() + try: +@@ -170,11 +169,11 @@ def getTitle(self, irc, url, raiseErrors): + return (target, title) + else: + if len(text) < size: +- self.log.info('Web plugin TitleSnarfer: ' +- 'That URL appears to have no HTML title.') +- except: +- irc.error(_('Web plugin TitleSnarfer encoding errors'), +- Raise=True) + self.log.info('Web plugin TitleSnarfer: <' + url + '> appears to have no HTML title.') + else: + self.log.info('Web plugin TitleSnarfer: Could not retrieve title of <' + url + '>')