summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-01-15 15:17:10 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-01-15 16:33:10 -0500
commit0054cad5ad181cc51bbeae7583cf607bf72e851e (patch)
tree47d1f18ee45caddfd16143eaaaf650c75b0e2057
parenta6f49177c5f24fd17ae12281a1878ff5b79b8b8e (diff)
downloadguix-0054cad5ad181cc51bbeae7583cf607bf72e851e.tar.gz
gnu: python-typing-inspect: Fix build on Python 3.9.
* gnu/packages/patches/python-typing-inspect-fix.patch: Add patch.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/python-xyz.scm (python-typing-inspect)[patches]: Apply it.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/python-typing-inspect-fix.patch38
-rw-r--r--gnu/packages/python-xyz.scm3
3 files changed, 41 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 35fd15126b..f84f859bdf 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1536,6 +1536,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-memcached-syntax-warnings.patch	\
   %D%/packages/patches/python-mox3-python3.6-compat.patch	\
   %D%/packages/patches/python-testtools.patch			\
+  %D%/packages/patches/python-typing-inspect-fix.patch		\
   %D%/packages/patches/python-onnx-use-system-googletest.patch	\
   %D%/packages/patches/python-packaging-test-arch.patch		\
   %D%/packages/patches/python2-parameterized-docstring-test.patch	\
diff --git a/gnu/packages/patches/python-typing-inspect-fix.patch b/gnu/packages/patches/python-typing-inspect-fix.patch
new file mode 100644
index 0000000000..e6e28981b7
--- /dev/null
+++ b/gnu/packages/patches/python-typing-inspect-fix.patch
@@ -0,0 +1,38 @@
+From 16919e21936179e53df2f376c8b59b5fc44bd2dd Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Fri, 15 Jan 2021 09:22:52 -0500
+Subject: [PATCH] Fix for Python 3.9+.
+
+Fixes <https://github.com/ilevkivskyi/typing_inspect/issues/60>.
+
+Based on an idea in
+https://github.com/ilevkivskyi/typing_inspect/issues/60#issuecomment-683187584.
+---
+ typing_inspect.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/typing_inspect.py b/typing_inspect.py
+index 1ca68ed..31d05ee 100644
+--- a/typing_inspect.py
++++ b/typing_inspect.py
+@@ -21,7 +21,7 @@ LEGACY_TYPING = False
+ 
+ if NEW_TYPING:
+     from typing import (
+-        Generic, Callable, Union, TypeVar, ClassVar, Tuple, _GenericAlias, ForwardRef
++        Generic, Callable, Union, TypeVar, ClassVar, Tuple, _GenericAlias, _SpecialGenericAlias, ForwardRef
+     )
+     from typing_extensions import Literal
+ else:
+@@ -75,7 +75,7 @@ def is_generic_type(tp):
+     """
+     if NEW_TYPING:
+         return (isinstance(tp, type) and issubclass(tp, Generic) or
+-                isinstance(tp, _GenericAlias) and
++                (isinstance(tp, _GenericAlias) or isinstance(tp, _SpecialGenericAlias)) and
+                 tp.__origin__ not in (Union, tuple, ClassVar, collections.abc.Callable))
+     return (isinstance(tp, GenericMeta) and not
+             isinstance(tp, (CallableMeta, TupleMeta)))
+-- 
+2.29.2
+
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index eb7c040437..b7f807723a 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -13236,7 +13236,8 @@ feels like an AST.")
               (uri (pypi-uri "typing_inspect" version))
               (sha256
                (base32
-                "1dzs9a1pr23dhbvmnvms2jv7l7jk26023g5ysf0zvnq8b791s6wg"))))
+                "1dzs9a1pr23dhbvmnvms2jv7l7jk26023g5ysf0zvnq8b791s6wg"))
+              (patches (search-patches "python-typing-inspect-fix.patch"))))
     (build-system python-build-system)
     (propagated-inputs
      `(("python-mypy-extensions" ,python-mypy-extensions)