forked from pool/python-tqdm
Accepting request 1191176 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1191176 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-tqdm?expand=0&rev=60
This commit is contained in:
commit
57d04895e1
75
fix-issues-with-python3.13.patch
Normal file
75
fix-issues-with-python3.13.patch
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
From eafdd306861f531c443885048f0abdaa6bc45f8e Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
||||||
|
Date: Thu, 27 Jun 2024 18:30:55 +0200
|
||||||
|
Subject: [PATCH 1/2] 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 7284f28d5..1bbce6d1f 100644
|
||||||
|
--- a/tqdm/cli.py
|
||||||
|
+++ b/tqdm/cli.py
|
||||||
|
@@ -4,6 +4,7 @@
|
||||||
|
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'
|
||||||
|
|
||||||
|
From 9e7528350b7733b2fb236ca4d615be60b2a4ac29 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
||||||
|
Date: Mon, 8 Jul 2024 17:26:13 +0200
|
||||||
|
Subject: [PATCH 2/2] Avoid Python 3.13+ RuntimeWarning: coroutine method
|
||||||
|
'aclose' of 'acount' was never awaited
|
||||||
|
|
||||||
|
See https://github.com/python/cpython/issues/117536#issuecomment-2036883124
|
||||||
|
---
|
||||||
|
tests/tests_asyncio.py | 12 ++++++++----
|
||||||
|
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/tests_asyncio.py b/tests/tests_asyncio.py
|
||||||
|
index bdef569fa..250e6585d 100644
|
||||||
|
--- a/tests/tests_asyncio.py
|
||||||
|
+++ b/tests/tests_asyncio.py
|
||||||
|
@@ -48,10 +48,14 @@ async def test_generators(capsys):
|
||||||
|
_, err = capsys.readouterr()
|
||||||
|
assert '9it' in err
|
||||||
|
|
||||||
|
- with tqdm(acount(), desc="async_counter") as pbar:
|
||||||
|
- async for i in pbar:
|
||||||
|
- if i >= 8:
|
||||||
|
- break
|
||||||
|
+ acounter = acount()
|
||||||
|
+ try:
|
||||||
|
+ with tqdm(acounter, desc="async_counter") as pbar:
|
||||||
|
+ async for i in pbar:
|
||||||
|
+ if i >= 8:
|
||||||
|
+ break
|
||||||
|
+ finally:
|
||||||
|
+ await acounter.aclose()
|
||||||
|
_, err = capsys.readouterr()
|
||||||
|
assert '9it' in err
|
||||||
|
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Aug 2 09:05:03 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
|
||||||
|
|
||||||
|
- Cherry-pick upstream patch to fix multiple issues with Python 3.13+
|
||||||
|
* fix-issues-with-python3.13.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri May 17 06:38:10 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
Fri May 17 06:38:10 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ Summary: An extensible progress meter
|
|||||||
License: MIT AND MPL-2.0
|
License: MIT AND MPL-2.0
|
||||||
URL: https://github.com/tqdm/tqdm
|
URL: https://github.com/tqdm/tqdm
|
||||||
Source: https://files.pythonhosted.org/packages/source/t/tqdm/tqdm-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/t/tqdm/tqdm-%{version}.tar.gz
|
||||||
|
# PATCH-FIX-UPSTREAM gh#qdm/tqdm#1595 - Fix multiple issues with Python 3.13+
|
||||||
|
Patch1: https://github.com/tqdm/tqdm/pull/1595.patch#/fix-issues-with-python3.13.patch
|
||||||
BuildRequires: %{python_module base >= 3.7}
|
BuildRequires: %{python_module base >= 3.7}
|
||||||
BuildRequires: %{python_module pip}
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module setuptools_scm}
|
BuildRequires: %{python_module setuptools_scm}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user