commit:     6964f819a7369bd6063caa74879eaa2faeaa6a10
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 27 16:50:14 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jun 27 16:50:46 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6964f819

dev-python/tqdm: Enable py3.13

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

 dev-python/tqdm/files/tqdm-4.66.4-py313.patch | 43 +++++++++++++++++++++++++++
 dev-python/tqdm/tqdm-4.66.4.ebuild            |  7 ++++-
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/dev-python/tqdm/files/tqdm-4.66.4-py313.patch 
b/dev-python/tqdm/files/tqdm-4.66.4-py313.patch
new file mode 100644
index 000000000000..9417ce91a55a
--- /dev/null
+++ b/dev-python/tqdm/files/tqdm-4.66.4-py313.patch
@@ -0,0 +1,43 @@
+From eafdd306861f531c443885048f0abdaa6bc45f8e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Thu, 27 Jun 2024 18:30:55 +0200
+Subject: [PATCH] cli: Fix docstring processing with Python 3.13+
+
+Fix docstring processing code to reindent the docstrings if using Python
+3.13 or newer.  Starting with this version, all docstrings are
+automatically dedented by Python, which causes the regular expression to
+fail to match.
+
+Fixes #1585
+---
+ tqdm/cli.py | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/tqdm/cli.py b/tqdm/cli.py
+index 7284f28..1bbce6d 100644
+--- a/tqdm/cli.py
++++ b/tqdm/cli.py
+@@ -4,6 +4,7 @@ Module version for monitoring CLI pipes (`... | python -m tqdm 
| ...`).
+ import logging
+ import re
+ import sys
++import textwrap
+ from ast import literal_eval as numeric
+ 
+ from .std import TqdmKeyError, TqdmTypeError, tqdm
+@@ -177,7 +178,11 @@ def main(fp=sys.stderr, argv=None):
+     logging.basicConfig(level=getattr(logging, logLevel),
+                         
format="%(levelname)s:%(module)s:%(lineno)d:%(message)s")
+ 
+-    d = tqdm.__doc__ + CLI_EXTRA_DOC
++    d = tqdm.__doc__
++    if sys.version_info >= (3, 13):
++        # Python 3.13+ automatically dedents docstrings
++        d = textwrap.indent(d, "    ")
++    d += CLI_EXTRA_DOC
+ 
+     opt_types = dict(RE_OPTS.findall(d))
+     # opt_types['delim'] = 'chr'
+-- 
+2.45.2
+

diff --git a/dev-python/tqdm/tqdm-4.66.4.ebuild 
b/dev-python/tqdm/tqdm-4.66.4.ebuild
index 17fcf05d9ae5..2dca9f1051c0 100644
--- a/dev-python/tqdm/tqdm-4.66.4.ebuild
+++ b/dev-python/tqdm/tqdm-4.66.4.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( pypy3 python3_{10..12} )
+PYTHON_COMPAT=( pypy3 python3_{10..13} )
 
 inherit bash-completion-r1 distutils-r1 pypi
 
@@ -29,6 +29,11 @@ BDEPEND="
 
 distutils_enable_tests pytest
 
+PATCHES=(
+       # https://github.com/tqdm/tqdm/pull/1594
+       "${FILESDIR}/${P}-py313.patch"
+)
+
 EPYTEST_IGNORE=(
        # Skip unpredictable performance tests
        tests/tests_perf.py

Reply via email to