guix-commits
[Top][All Lists]
Advanced

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

01/02: gnu: python-typeguard: Python 3.10 compatibility.


From: guix-commits
Subject: 01/02: gnu: python-typeguard: Python 3.10 compatibility.
Date: Sat, 18 Mar 2023 05:42:37 -0400 (EDT)

lbraun pushed a commit to branch core-updates
in repository guix.

commit a7c96167ae8748a8b76fabaf74a997094cdf7fc5
Author: Lars-Dominik Braun <lars@6xq.net>
AuthorDate: Sat Mar 18 10:17:57 2023 +0100

    gnu: python-typeguard: Python 3.10 compatibility.
    
    * gnu/packages/patches/python-typeguard-python3.10.patch: New file.
    * gnu/local.mk: Register it.
    * gnu/packages/python-xyz.scm (python-typeguard): Use it.
---
 gnu/local.mk                                       |  1 +
 .../patches/python-typeguard-python3.10.patch      | 47 ++++++++++++++++++++++
 gnu/packages/python-xyz.scm                        |  3 +-
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 6a7e41c476..43b7e4ceb3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1644,6 +1644,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/python-pypdf-annotate-tests-appropriately.patch \
   %D%/packages/patches/python-sgmllib3k-assertions.patch       \
   %D%/packages/patches/python-telingo-fix-comparison.patch     \
+  %D%/packages/patches/python-typeguard-python3.10.patch       \
   %D%/packages/patches/python-w3lib-fix-test-failure.patch     \
   %D%/packages/patches/sdcc-disable-non-free-code.patch                \
   %D%/packages/patches/sdl-pango-api_additions.patch           \
diff --git a/gnu/packages/patches/python-typeguard-python3.10.patch 
b/gnu/packages/patches/python-typeguard-python3.10.patch
new file mode 100644
index 0000000000..29321d8918
--- /dev/null
+++ b/gnu/packages/patches/python-typeguard-python3.10.patch
@@ -0,0 +1,47 @@
+Taken from Gentoo, which adapted
+https://github.com/agronholm/typeguard/commit/e0db07a777d5a481eaba6162354adf32286ce21b
+
+diff --git a/src/typeguard/__init__.py b/src/typeguard/__init__.py
+index 5684d63..27fa30b 100644
+--- a/src/typeguard/__init__.py
++++ b/src/typeguard/__init__.py
+@@ -61,22 +61,25 @@ except ImportError:
+     from typing import _ForwardRef as ForwardRef
+     evaluate_forwardref = ForwardRef._eval_type
+ 
+-if sys.version_info >= (3, 10):
+-    from typing import is_typeddict
+-else:
+-    _typed_dict_meta_types = ()
+-    if sys.version_info >= (3, 8):
+-        from typing import _TypedDictMeta
+-        _typed_dict_meta_types += (_TypedDictMeta,)
++try:
++    from typing_extensions import is_typeddict
++except ImportError:
++    if sys.version_info >= (3, 10):
++        from typing import is_typeddict
++    else:
++        _typed_dict_meta_types = ()
++        if sys.version_info >= (3, 8):
++            from typing import _TypedDictMeta
++            _typed_dict_meta_types += (_TypedDictMeta,)
+ 
+-    try:
+-        from typing_extensions import _TypedDictMeta
+-        _typed_dict_meta_types += (_TypedDictMeta,)
+-    except ImportError:
+-        pass
++        try:
++            from typing_extensions import _TypedDictMeta
++            _typed_dict_meta_types += (_TypedDictMeta,)
++        except ImportError:
++            pass
+ 
+-    def is_typeddict(tp) -> bool:
+-        return isinstance(tp, _typed_dict_meta_types)
++        def is_typeddict(tp) -> bool:
++            return isinstance(tp, _typed_dict_meta_types)
+ 
+ 
+ if TYPE_CHECKING:
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index d637b073df..d1908ec956 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -22390,7 +22390,8 @@ based on the CPython 2.7 and 3.7 parsers.")
        (method url-fetch)
        (uri (pypi-uri "typeguard" version))
        (sha256
-        (base32 "1i5qzcyw2715h1g1hvj7fxykck2bkxyshpngjr3nfcx1lf6smv80"))))
+        (base32 "1i5qzcyw2715h1g1hvj7fxykck2bkxyshpngjr3nfcx1lf6smv80"))
+       (patches (search-patches "python-typeguard-python3.10.patch"))))
     (build-system python-build-system)
     (arguments
      (list



reply via email to

[Prev in Thread] Current Thread [Next in Thread]