[arch-commits] Commit in monkeytype/trunk (PKGBUILD py3.9.patch)
Felix Yan
felixonmars at archlinux.org
Fri Nov 20 21:56:13 UTC 2020
Date: Friday, November 20, 2020 @ 21:56:13
Author: felixonmars
Revision: 758153
add fix for python 3.9 (https://github.com/Instagram/MonkeyType/pull/217)
Added:
monkeytype/trunk/py3.9.patch
Modified:
monkeytype/trunk/PKGBUILD
-------------+
PKGBUILD | 12 ++++++++++--
py3.9.patch | 31 +++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 2 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2020-11-20 21:46:19 UTC (rev 758152)
+++ PKGBUILD 2020-11-20 21:56:13 UTC (rev 758153)
@@ -11,9 +11,17 @@
depends=('python-mypy_extensions' 'python-libcst')
makedepends=('python-setuptools')
checkdepends=('python-pytest-runner' 'python-pytest-cov' 'python-django')
-source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
-sha512sums=('1fd0eb9bd83e7f27de5b7e75d06a89d851220b165d8becd7bac75c196361315669142c5f8838e85696e5dceaeaae6b64b71e3e46010546c65fa4f9d9b62f55d2')
+source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz"
+ py3.9.patch)
+sha512sums=('1fd0eb9bd83e7f27de5b7e75d06a89d851220b165d8becd7bac75c196361315669142c5f8838e85696e5dceaeaae6b64b71e3e46010546c65fa4f9d9b62f55d2'
+ '81b37bf0ca06a65d10aa5efe7da200564b234247eb63c619a2ad3243ad243f9aebeaf244dfd69c4032341c47febd12e03c8ac5b4fe8dedf21492600c874ac4d3')
+prepare() {
+ cd $_pkgname-$pkgver
+
+ patch -p1 -i ../py3.9.patch
+}
+
build() {
cd $_pkgname-$pkgver
Added: py3.9.patch
===================================================================
--- py3.9.patch (rev 0)
+++ py3.9.patch 2020-11-20 21:56:13 UTC (rev 758153)
@@ -0,0 +1,31 @@
+commit 6a60845958efffcec987ed1c6ce90e74cf7c8456
+Author: Felix Yan <felixonmars at archlinux.org>
+Date: Sat Nov 21 05:50:14 2020 +0800
+
+ Fix compatibility with Python 3.9
+
+ Fixes #205, all tests are passing here.
+
+diff --git a/monkeytype/compat.py b/monkeytype/compat.py
+index 01d5007..111d28e 100644
+--- a/monkeytype/compat.py
++++ b/monkeytype/compat.py
+@@ -22,8 +22,16 @@ try:
+ def is_union(typ: Any) -> bool:
+ return typ is Union or is_generic(typ) and typ.__origin__ is Union
+
+- def is_generic(typ: Any) -> bool:
+- return typ is Union or isinstance(typ, _GenericAlias)
++ try:
++ # Python 3.9
++ from typing import _SpecialGenericAlias
++
++ def is_generic(typ: Any) -> bool:
++ return typ is Union or isinstance(typ, _GenericAlias) or isinstance(typ, _SpecialGenericAlias)
++
++ except ImportError:
++ def is_generic(typ: Any) -> bool:
++ return typ is Union or isinstance(typ, _GenericAlias)
+
+ def is_generic_of(typ: Any, gen: Any) -> bool:
+ return is_generic(typ) and typ.__origin__ is gen.__origin__
More information about the arch-commits
mailing list