commit:     3a323b02beb6cc986c4451b5c9fd2b0323b3ffc2
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  9 18:13:42 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul  9 19:29:19 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a323b02

dev-python/mypy: Enable py3.13

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/mypy/files/mypy-1.10.1-py313.patch | 25 +++++++++++++++++++++++++
 dev-python/mypy/mypy-1.10.1.ebuild            | 19 +++++++++++++++++--
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/dev-python/mypy/files/mypy-1.10.1-py313.patch 
b/dev-python/mypy/files/mypy-1.10.1-py313.patch
new file mode 100644
index 000000000000..d98bc079cb52
--- /dev/null
+++ b/dev-python/mypy/files/mypy-1.10.1-py313.patch
@@ -0,0 +1,25 @@
+From 29b4303e905f43556043efde95e19f32e04df9a5 Mon Sep 17 00:00:00 2001
+From: Jelle Zijlstra <[email protected]>
+Date: Fri, 24 May 2024 21:00:17 -0700
+Subject: [PATCH] Fix stubgen for Python 3.13
+
+__firstlineno__ and __static_attributes__ are new in 3.13.
+__annotate__ will be new in 3.14, so we might as well add it now.
+---
+ mypy/stubgenc.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/mypy/stubgenc.py b/mypy/stubgenc.py
+index 29b2636d39cc..7e3ef49c6e9a 100755
+--- a/mypy/stubgenc.py
++++ b/mypy/stubgenc.py
+@@ -466,6 +466,9 @@ def is_skipped_attribute(self, attr: str) -> bool:
+                 "__module__",
+                 "__weakref__",
+                 "__annotations__",
++                "__firstlineno__",
++                "__static_attributes__",
++                "__annotate__",
+             )
+             or attr in self.IGNORED_DUNDERS
+             or is_pybind_skipped_attribute(attr)  # For pickling

diff --git a/dev-python/mypy/mypy-1.10.1.ebuild 
b/dev-python/mypy/mypy-1.10.1.ebuild
index 2f0a69442d64..70f03443e40a 100644
--- a/dev-python/mypy/mypy-1.10.1.ebuild
+++ b/dev-python/mypy/mypy-1.10.1.ebuild
@@ -5,9 +5,9 @@ EAPI=8
 
 DISTUTILS_EXT=1
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{10..12} )
+PYTHON_COMPAT=( python3_{10..13} )
 
-inherit distutils-r1 multiprocessing
+inherit distutils-r1
 
 DESCRIPTION="Optional static typing for Python"
 HOMEPAGE="
@@ -51,6 +51,11 @@ BDEPEND="
 EPYTEST_XDIST=1
 distutils_enable_tests pytest
 
+PATCHES=(
+       # https://github.com/python/mypy/pull/17290
+       "${FILESDIR}/${P}-py313.patch"
+)
+
 # frustratingly, mypyc produces non-deterministic output. If ccache is enabled 
it will be a waste of time,
 # but simultaneously it might trash your system and fill up the cache with a 
giant wave of non-reproducible
 # test files (https://github.com/mypyc/mypyc/issues/1014)
@@ -58,6 +63,11 @@ export CCACHE_DISABLE=1
 
 src_compile() {
        local -x MYPY_USE_MYPYC=$(usex native-extensions 1 0)
+       case ${EPYTHON} in
+               python3.13)
+                       # https://github.com/mypyc/mypyc/issues/1056
+                       MYPY_USE_MYPYC=0
+       esac
        distutils-r1_src_compile
 }
 
@@ -87,6 +97,11 @@ python_test() {
                                
mypyc/test/test_run.py::TestRun::run-i64.test::testI64ErrorValuesAndUndefined
                        )
                        ;;
+               python3.13)
+                       EPYTEST_DESELECT+=(
+                               # https://github.com/mypyc/mypyc/issues/1056
+                               mypyc/test
+                       )
        esac
 
        # Some mypy/test/testcmdline.py::PythonCmdlineSuite tests

Reply via email to