From 9a455ff2bd1a30e170a0ec01a6b8914a2de77daf159266a0d1f89e05b009c6f2 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Fri, 24 Nov 2023 04:34:26 +0000 Subject: [PATCH] - Add patch sprinkle-in-timezone.patch: * Add a timezone to the call fromtimestamp() - Switch to autosetup macro. - Remove conditionals from some BuildRequires. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-tqdm?expand=0&rev=122 --- python-tqdm.changes | 8 ++++++++ python-tqdm.spec | 14 ++++++++------ sprinkle-in-timezone.patch | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 sprinkle-in-timezone.patch diff --git a/python-tqdm.changes b/python-tqdm.changes index a3d7959..1e9c964 100644 --- a/python-tqdm.changes +++ b/python-tqdm.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Nov 24 04:33:40 UTC 2023 - Steve Kowalik + +- Add patch sprinkle-in-timezone.patch: + * Add a timezone to the call fromtimestamp() +- Switch to autosetup macro. +- Remove conditionals from some BuildRequires. + ------------------------------------------------------------------- Wed Aug 30 13:36:56 UTC 2023 - ecsos diff --git a/python-tqdm.spec b/python-tqdm.spec index ca12f52..375ad34 100644 --- a/python-tqdm.spec +++ b/python-tqdm.spec @@ -34,6 +34,8 @@ Summary: An extensible progress meter License: MIT AND MPL-2.0 URL: https://github.com/tqdm/tqdm Source: https://files.pythonhosted.org/packages/source/t/tqdm/tqdm-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#tqdm/tqdm#1519 Specify a timezone for fromtimestamp() +Patch0: sprinkle-in-timezone.patch BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools_scm} @@ -48,13 +50,13 @@ Enhances: python-ipython BuildArch: noarch %if %{with test} # SECTION test requirements -BuildRequires: %{python_module numpy if (python-base without python36-base)} BuildRequires: %{python_module pytest-asyncio} +BuildRequires: %{python_module numpy} BuildRequires: %{python_module pytest-timeout} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module tqdm} +BuildRequires: %{python_module tqdm = %{version}} %if ! 0%{?_with_ringdisabled} -BuildRequires: %{python_module pandas if (python-base without python36-base)} +BuildRequires: %{python_module pandas} %endif # /SECTION %endif @@ -80,9 +82,9 @@ and does not require ncurses. This package provides the completion file for bash %prep -%setup -q -n tqdm-%{version} +%autosetup -p1 -n tqdm-%{version} # ignore new asyncio mode warning from pytest-asyncio 0.17 -sed -i 's/-W=error//' setup.cfg +sed -i 's/-W=error//' pyproject.toml # remove bash shebang for completion script sed -i '1 s/^#!.*/# bash completion for tqdm -*- shell-script -*-/' tqdm/completion.sh chmod a-x tqdm/completion.sh @@ -119,7 +121,7 @@ install -m 644 -D tqdm/completion.sh %{buildroot}%{_datadir}/bash-completion/com %doc examples/ %license LICENCE %{python_sitelib}/tqdm/ -%{python_sitelib}/tqdm-%{version}*-info +%{python_sitelib}/tqdm-%{version}.dist-info %python_alternative %{_bindir}/tqdm %files -n %{allpython}-tqdm-bash-completion diff --git a/sprinkle-in-timezone.patch b/sprinkle-in-timezone.patch new file mode 100644 index 0000000..a730dff --- /dev/null +++ b/sprinkle-in-timezone.patch @@ -0,0 +1,32 @@ +From 6945b214bc4faac8db459d8734b4b8d116ba54a9 Mon Sep 17 00:00:00 2001 +From: jamate +Date: Wed, 4 Oct 2023 11:58:14 -0500 +Subject: [PATCH] Fix DeprecationWarning for datetime.utcfromtimestamp in + Python 3.12 + +--- + tqdm/std.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tqdm/std.py b/tqdm/std.py +index 9ba8e8506..83386c5fe 100644 +--- a/tqdm/std.py ++++ b/tqdm/std.py +@@ -10,7 +10,7 @@ + import sys + from collections import OrderedDict, defaultdict + from contextlib import contextmanager +-from datetime import datetime, timedelta ++from datetime import datetime, timedelta, timezone + from numbers import Number + from time import time + from warnings import warn +@@ -577,7 +577,7 @@ def format_meter(n, total, elapsed, ncols=None, prefix='', ascii=False, unit='it + remaining_str = tqdm.format_interval(remaining) if rate else '?' + try: + eta_dt = (datetime.now() + timedelta(seconds=remaining) +- if rate and total else datetime.utcfromtimestamp(0)) ++ if rate and total else datetime.fromtimestamp(0, timezone.utc)) + except OverflowError: + eta_dt = datetime.max +