Accepting request 1128418 from devel:languages:python

- 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/request/show/1128418
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-tqdm?expand=0&rev=57
This commit is contained in:
Ana Guerrero 2023-11-26 18:36:22 +00:00 committed by Git OBS Bridge
commit f686a490f8
3 changed files with 48 additions and 6 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Nov 24 04:33:40 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- 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 <ecsos@opensuse.org>

View File

@ -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

View File

@ -0,0 +1,32 @@
From 6945b214bc4faac8db459d8734b4b8d116ba54a9 Mon Sep 17 00:00:00 2001
From: jamate <mateoarcilalopez@gmail.com>
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