Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
6b01d44680
!30 update to 2.12.1 and fix the testcase failure after the upgrade
From: @zhoupengcheng11 
Reviewed-by: @lvying6 
Signed-off-by: @lvying6
2023-08-08 02:55:25 +00:00
zhoupengcheng
a326d2878c update to 2.12.1 and fix the testcase failure after the upgrade 2023-08-07 20:27:34 +08:00
openeuler-ci-bot
f124d70610
!28 update to 2.11.0
From: @znzjugod 
Reviewed-by: @lvying6 
Signed-off-by: @lvying6
2023-01-29 03:41:03 +00:00
znzjugod
7eb9dec974 update to 2.11.0 2023-01-19 11:30:10 +08:00
openeuler-ci-bot
2db51eb5b9
!24 fix rpmbuild warning
From: @markeryang 
Reviewed-by: @lvying6 
Signed-off-by: @lvying6
2022-10-26 06:56:14 +00:00
markeryang
4d7ca534e4 fix rpmbuild warning 2022-10-22 17:28:12 +08:00
openeuler-ci-bot
1e4120be06
!22 update to 2.10.3
#I5DUZQ  
From: @panxh_purple 
Reviewed-by: @xiezhipeng1 
Signed-off-by: @xiezhipeng1
2022-07-05 01:39:40 +00:00
panxiaohe
5cb3d28cd7 update to 2.10.3 2022-07-04 17:35:49 +08:00
openeuler-ci-bot
7a17816e92
!21 【master分支】使能测试用例
From: @yang_zhuang_zhuang 
Reviewed-by: @xiezhipeng1 
Signed-off-by: @xiezhipeng1
2022-02-17 02:53:12 +00:00
yang_zhuang_zhuang
1b2510b998 enable make check 2022-02-15 14:06:55 +08:00
4 changed files with 163 additions and 6 deletions

View File

@ -1,15 +1,16 @@
%global _with_bootstrap 1
%bcond_with bootstrap
Name: babel
Version: 2.9.1
Release: 3
Version: 2.12.1
Release: 1
Summary: Tools for internationalizing and localizing Python applications
License: BSD
URL: http://babel.pocoo.org/
Source0: https://files.pythonhosted.org/packages/source/B/Babel/Babel-%{version}.tar.gz
Patch6000: backport-Freeze-format_time-tests-to-a-specific-date-to-fix-t.patch
Patch6001: backport-Use-aware-UTC-datetimes-internally.patch
BuildArch: noarch
BuildRequires: gcc make
@ -39,7 +40,7 @@ Summary: Documentation for Babel
Provides: python-babel-doc = %{version}-%{release}
Provides: python3-babel-doc = %{version}-%{release}
Provides: babel-doc
Obsoletes: babel-doc
Obsoletes: babel-doc < %{version}-%{release}
%description help
Documentation for Babel
@ -82,7 +83,7 @@ export TZ=UTC
%postun
%files
%doc CHANGES AUTHORS
%doc CHANGES.rst AUTHORS
%license LICENSE
%{_bindir}/pybabel
@ -96,6 +97,24 @@ export TZ=UTC
%endif
%changelog
* Mon Aug 7 2023 zhoupengcheng <zhoupengcheng11@huawei.com> - 2.12.1-1
- update to 2.12.1
- backport two patches from upstream to fix testcase failure after upgrade 2.12.1
backport-Freeze-format_time-tests-to-a-specific-date-to-fix-t.patch
backport-Use-aware-UTC-datetimes-internally.patch
* Thu Jan 19 2023 zhangnan <zhangnan134@huawei.com> - 2.11.0-1
- update to 2.11.0
* Sat Oct 22 2022 yanglongkang <yanglongkang@h-partners.com> - 2.10.3-2
- fix rpmbuild warning
* Mon Jul 4 2022 panxiaohe <panxh.life@foxmail.com> - 2.10.3-1
- update to 2.10.3
* Tue Feb 15 2022 yangzhuangzhuang <yangzhuangzhuang1@h-partners.com> - 2.9.1-4
- enable make check
* Fri Dec 3 2021 panxiaohe <panxiaohe@huawei.com> - 2.9.1-3
- add Bootstrap for Python 3.10

View File

@ -0,0 +1,41 @@
From 8b152dbe47cb830f66ad12bd3057e6128aeac072 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Tue, 9 May 2023 10:20:04 +0200
Subject: [PATCH] Freeze format_time() tests to a specific date to fix test
failures (#998)
Freeze the date when performing the tests for format_time() with
a timezone specified. Since the time object does not specify a date,
the formatter uses the format string specific to the current date.
As a result, if the current DST state is different than when the test
was last updated, it failed.
---
tests/test_dates.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tests/test_dates.py b/tests/test_dates.py
index b94c710..3f1fc3f 100644
--- a/tests/test_dates.py
+++ b/tests/test_dates.py
@@ -601,12 +601,13 @@ def test_format_time(timezone_getter):
custom = dates.format_time(t, "hh 'o''clock' a, zzzz", tzinfo=eastern, locale='en')
assert custom == "09 o'clock AM, Eastern Daylight Time"
- t = time(15, 30)
- paris = dates.format_time(t, format='full', tzinfo=paris, locale='fr_FR')
- assert paris == '15:30:00 heure normale dEurope centrale'
+ with freezegun.freeze_time("2023-01-01"):
+ t = time(15, 30)
+ paris = dates.format_time(t, format='full', tzinfo=paris, locale='fr_FR')
+ assert paris == '15:30:00 heure normale dEurope centrale'
- us_east = dates.format_time(t, format='full', tzinfo=eastern, locale='en_US')
- assert us_east == '3:30:00\u202fPM Eastern Standard Time'
+ us_east = dates.format_time(t, format='full', tzinfo=eastern, locale='en_US')
+ assert us_east == '3:30:00\u202fPM Eastern Standard Time'
def test_format_skeleton(timezone_getter):
--
2.27.0

View File

@ -0,0 +1,97 @@
From 1747d2230a0294a07c99563cf50fb95a37b6ac0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Tue, 27 Jun 2023 23:08:06 +0300
Subject: [PATCH] Use aware UTC datetimes internally (#1009)
Avoids deprecation warnings on Python 3.12.
---
babel/dates.py | 10 +++++-----
docs/dates.rst | 6 +++---
tests/test_dates.py | 6 +++---
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/babel/dates.py b/babel/dates.py
index ad82b789b..ddc8e7105 100644
--- a/babel/dates.py
+++ b/babel/dates.py
@@ -112,7 +112,7 @@ def _get_tz_name(dt_or_tzinfo: _DtOrTzinfo) -> str:
elif hasattr(tzinfo, 'key') and tzinfo.key is not None: # ZoneInfo object
return tzinfo.key
else:
- return tzinfo.tzname(dt or datetime.datetime.utcnow())
+ return tzinfo.tzname(dt or datetime.datetime.now(UTC))
def _get_datetime(instant: _Instant) -> datetime.datetime:
@@ -147,9 +147,9 @@ def _get_datetime(instant: _Instant) -> datetime.datetime:
:rtype: datetime
"""
if instant is None:
- return datetime.datetime.utcnow()
+ return datetime.datetime.now(UTC).replace(tzinfo=None)
elif isinstance(instant, (int, float)):
- return datetime.datetime.utcfromtimestamp(instant)
+ return datetime.datetime.fromtimestamp(instant, UTC).replace(tzinfo=None)
elif isinstance(instant, datetime.time):
return datetime.datetime.combine(datetime.date.today(), instant)
elif isinstance(instant, datetime.date) and not isinstance(instant, datetime.datetime):
@@ -201,9 +201,9 @@ def _get_time(
:rtype: time
"""
if time is None:
- time = datetime.datetime.utcnow()
+ time = datetime.datetime.now(UTC)
elif isinstance(time, (int, float)):
- time = datetime.datetime.utcfromtimestamp(time)
+ time = datetime.datetime.fromtimestamp(time, UTC)
if time.tzinfo is None:
time = time.replace(tzinfo=UTC)
diff --git a/docs/dates.rst b/docs/dates.rst
index 1827a9a20..0c2c17fc0 100644
--- a/docs/dates.rst
+++ b/docs/dates.rst
@@ -67,9 +67,9 @@ local time when returning dates to users. At that point the timezone the
user has selected can usually be established and Babel can automatically
rebase the time for you.
-To get the current time use the :meth:`~datetime.datetime.utcnow` method
-of the :class:`~datetime.datetime` object. It will return a naive
-:class:`~datetime.datetime` object in UTC.
+To get the current time use the :meth:`~datetime.datetime.now` method
+of the :class:`~datetime.datetime` object,
+passing :attr:`~datetime.timezone.utc` to it as the timezone.
For more information about timezones see :ref:`timezone-support`.
diff --git a/tests/test_dates.py b/tests/test_dates.py
index 3f1fc3fc8..f4f577397 100644
--- a/tests/test_dates.py
+++ b/tests/test_dates.py
@@ -17,7 +17,7 @@
import pytest
from babel import Locale, dates
-from babel.dates import NO_INHERITANCE_MARKER, _localize
+from babel.dates import NO_INHERITANCE_MARKER, UTC, _localize
from babel.util import FixedOffsetTimezone
@@ -542,7 +542,7 @@ def test_get_timezone_name_time_pytz(timezone_getter, tzname, params, expected):
def test_get_timezone_name_misc(timezone_getter):
- localnow = datetime.utcnow().replace(tzinfo=timezone_getter('UTC')).astimezone(dates.LOCALTZ)
+ localnow = datetime.now(timezone_getter('UTC')).astimezone(dates.LOCALTZ)
assert (dates.get_timezone_name(None, locale='en_US') ==
dates.get_timezone_name(localnow, locale='en_US'))
@@ -703,7 +703,7 @@ def test_zh_TW_format():
def test_format_current_moment():
- frozen_instant = datetime.utcnow()
+ frozen_instant = datetime.now(UTC)
with freezegun.freeze_time(time_to_freeze=frozen_instant):
assert dates.format_datetime(locale="en_US") == dates.format_datetime(frozen_instant, locale="en_US")