From ec46b8bd78f6e9dd59402ab69ec6659361d1923c Mon Sep 17 00:00:00 2001 From: nia Date: Tue, 31 Jul 2018 16:14:29 +0000 Subject: chat/py-mastodon: Add a patch to avoid the use of the 'async' keyword, allowing it to be used with Python 3.7. --- chat/py-mastodon/Makefile | 5 +- chat/py-mastodon/distinfo | 3 +- .../py-mastodon/patches/patch-mastodon_Mastodon.py | 80 ++++++++++++++++++++++ 3 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 chat/py-mastodon/patches/patch-mastodon_Mastodon.py diff --git a/chat/py-mastodon/Makefile b/chat/py-mastodon/Makefile index 58fbe6676c3..1ea5ea79551 100644 --- a/chat/py-mastodon/Makefile +++ b/chat/py-mastodon/Makefile @@ -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 @@ LICENSE= mit 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 --git a/chat/py-mastodon/distinfo b/chat/py-mastodon/distinfo index 3ae2e892517..1dd89a93909 100644 --- a/chat/py-mastodon/distinfo +++ b/chat/py-mastodon/distinfo @@ -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 --git a/chat/py-mastodon/patches/patch-mastodon_Mastodon.py b/chat/py-mastodon/patches/patch-mastodon_Mastodon.py new file mode 100644 index 00000000000..1940a94051b --- /dev/null +++ b/chat/py-mastodon/patches/patch-mastodon_Mastodon.py @@ -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 -- cgit v1.2.3