pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/chat/py-mastodon chat/py-mastodon: Add a patch to avoi...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5f8821cbcd04
branches:  trunk
changeset: 383463:5f8821cbcd04
user:      nia <nia%pkgsrc.org@localhost>
date:      Tue Jul 31 16:14:29 2018 +0000

description:
chat/py-mastodon: Add a patch to avoid the use of the 'async' keyword,
allowing it to be used with Python 3.7.

diffstat:

 chat/py-mastodon/Makefile                           |   5 +-
 chat/py-mastodon/distinfo                           |   3 +-
 chat/py-mastodon/patches/patch-mastodon_Mastodon.py |  80 +++++++++++++++++++++
 3 files changed, 83 insertions(+), 5 deletions(-)

diffs (115 lines):

diff -r bafca4a87d1e -r 5f8821cbcd04 chat/py-mastodon/Makefile
--- a/chat/py-mastodon/Makefile Tue Jul 31 15:55:16 2018 +0000
+++ b/chat/py-mastodon/Makefile Tue Jul 31 16:14:29 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2018/07/31 15:54:26 nia Exp $
+# $NetBSD: Makefile,v 1.5 2018/07/31 16:14:29 nia Exp $
 
 VERSION=       1.2.2
 DISTNAME=      Mastodon.py-${VERSION}
@@ -14,9 +14,6 @@
 EXTRACT_USING= bsdtar
 USE_LANGUAGES= # none
 
-# collision with the async keyword, issues/120
-PYTHON_VERSIONS_INCOMPATIBLE+= 37
-
 DEPENDS+=      ${PYPKGPREFIX}-dateutil-[0-9]*:../../time/py-dateutil
 DEPENDS+=      ${PYPKGPREFIX}-decorator-[0-9]*:../../devel/py-decorator
 DEPENDS+=      ${PYPKGPREFIX}-pytz-[0-9]*:../../time/py-pytz
diff -r bafca4a87d1e -r 5f8821cbcd04 chat/py-mastodon/distinfo
--- a/chat/py-mastodon/distinfo Tue Jul 31 15:55:16 2018 +0000
+++ b/chat/py-mastodon/distinfo Tue Jul 31 16:14:29 2018 +0000
@@ -1,6 +1,7 @@
-$NetBSD: distinfo,v 1.1 2018/07/25 17:00:57 nia Exp $
+$NetBSD: distinfo,v 1.2 2018/07/31 16:14:29 nia Exp $
 
 SHA1 (Mastodon.py-1.2.2.tar.gz) = 1589bf3c18e1ae765cd8312a4cb53164d4447d08
 RMD160 (Mastodon.py-1.2.2.tar.gz) = 282216a8179a1f019432943d5039105fc6fa3fd7
 SHA512 (Mastodon.py-1.2.2.tar.gz) = 4e82fec7a53c36a14f27a238ac97a2f71cdfbb10671013d60f3083456209c2916f7a1e22015d33238c017a9f81c46e4703477076d5974cb86816af048b5c5ecf
 Size (Mastodon.py-1.2.2.tar.gz) = 19793 bytes
+SHA1 (patch-mastodon_Mastodon.py) = a1baf579da05905dcb1cf679c728877dd3fcee54
diff -r bafca4a87d1e -r 5f8821cbcd04 chat/py-mastodon/patches/patch-mastodon_Mastodon.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/chat/py-mastodon/patches/patch-mastodon_Mastodon.py       Tue Jul 31 16:14:29 2018 +0000
@@ -0,0 +1,80 @@
+$NetBSD: patch-mastodon_Mastodon.py,v 1.1 2018/07/31 16:14:29 nia Exp $
+
+'async' is a reserved keyword in Python 3.7.
+
+--- mastodon/Mastodon.py.orig  2018-01-29 14:20:16.000000000 +0000
++++ mastodon/Mastodon.py
+@@ -1381,45 +1381,45 @@ class Mastodon:
+     # Streaming
+     ###
+     @api_version("1.1.0", "1.4.2")    
+-    def stream_user(self, listener, async=False):
++    def stream_user(self, listener, run_async=False):
+         """
+         Streams events that are relevant to the authorized user, i.e. home
+         timeline and notifications.
+         """
+-        return self.__stream('/api/v1/streaming/user', listener, async=async)
++        return self.__stream('/api/v1/streaming/user', listener, run_async=run_async)
+ 
+     @api_version("1.1.0", "1.4.2")
+-    def stream_public(self, listener, async=False):
++    def stream_public(self, listener, run_async=False):
+         """
+         Streams public events.
+         """
+-        return self.__stream('/api/v1/streaming/public', listener, async=async)
++        return self.__stream('/api/v1/streaming/public', listener, run_async=run_async)
+ 
+     @api_version("1.1.0", "1.4.2")
+-    def stream_local(self, listener, async=False):
++    def stream_local(self, listener, run_async=False):
+         """
+         Streams local public events.
+         """
+-        return self.__stream('/api/v1/streaming/public/local', listener, async=async)
++        return self.__stream('/api/v1/streaming/public/local', listener, run_async=run_async)
+ 
+     @api_version("1.1.0", "1.4.2")
+-    def stream_hashtag(self, tag, listener, async=False):
++    def stream_hashtag(self, tag, listener, run_async=False):
+         """
+         Stream for all public statuses for the hashtag 'tag' seen by the connected
+         instance.
+         """
+         if tag.startswith("#"):
+             raise MastodonIllegalArgumentError("Tag parameter should omit leading #")
+-        return self.__stream("/api/v1/streaming/hashtag?tag={}".format(tag), listener, async=async)
++        return self.__stream("/api/v1/streaming/hashtag?tag={}".format(tag), listener, run_async=run_async)
+ 
+     @api_version("2.1.0", "2.1.0")
+-    def stream_list(self, id, listener, async=False):
++    def stream_list(self, id, listener, run_async=False):
+         """
+         Stream events for the current user, restricted to accounts on the given
+         list. 
+         """
+         id =  self.__unpack_id(id)
+-        return self.__stream("/api/v1/streaming/list?list={}".format(id), listener, async=async)
++        return self.__stream("/api/v1/streaming/list?list={}".format(id), listener, run_async=run_async)
+     
+     ###
+     # Internal helpers, dragons probably
+@@ -1661,7 +1661,7 @@ class Mastodon:
+ 
+         return response
+ 
+-    def __stream(self, endpoint, listener, params={}, async=False):
++    def __stream(self, endpoint, listener, params={}, usync=False):
+         """
+         Internal streaming API helper.
+ 
+@@ -1720,7 +1720,7 @@ class Mastodon:
+ 
+         handle = __stream_handle(connection)
+ 
+-        if async:
++        if run_async:
+             t = threading.Thread(args=(), daemon = True, target=handle._threadproc)
+             t.start()
+             return handle



Home | Main Index | Thread Index | Old Index