summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornia <nia@pkgsrc.org>2018-07-31 16:14:29 +0000
committernia <nia@pkgsrc.org>2018-07-31 16:14:29 +0000
commitec46b8bd78f6e9dd59402ab69ec6659361d1923c (patch)
tree666c4b89ad07c4d6dbca7b71ff418932e78a5f96
parent547ca687262d93ccf4368a616cfc29ffed55c759 (diff)
downloadpkgsrc-ec46b8bd78f6e9dd59402ab69ec6659361d1923c.tar.gz
chat/py-mastodon: Add a patch to avoid the use of the 'async' keyword,
allowing it to be used with Python 3.7.
-rw-r--r--chat/py-mastodon/Makefile5
-rw-r--r--chat/py-mastodon/distinfo3
-rw-r--r--chat/py-mastodon/patches/patch-mastodon_Mastodon.py80
3 files changed, 83 insertions, 5 deletions
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