Compare commits
No commits in common. "6b01d44680bb1a6402216f381babd6a2c9a3b298" and "7ca18b81bd3ef7ba760896630c77a4ee7a0ca81b" have entirely different histories.
6b01d44680
...
7ca18b81bd
Binary file not shown.
31
babel.spec
31
babel.spec
@ -1,16 +1,15 @@
|
|||||||
|
%global _with_bootstrap 1
|
||||||
|
|
||||||
%bcond_with bootstrap
|
%bcond_with bootstrap
|
||||||
|
|
||||||
Name: babel
|
Name: babel
|
||||||
Version: 2.12.1
|
Version: 2.9.1
|
||||||
Release: 1
|
Release: 3
|
||||||
Summary: Tools for internationalizing and localizing Python applications
|
Summary: Tools for internationalizing and localizing Python applications
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: http://babel.pocoo.org/
|
URL: http://babel.pocoo.org/
|
||||||
Source0: https://files.pythonhosted.org/packages/source/B/Babel/Babel-%{version}.tar.gz
|
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
|
BuildArch: noarch
|
||||||
|
|
||||||
BuildRequires: gcc make
|
BuildRequires: gcc make
|
||||||
@ -40,7 +39,7 @@ Summary: Documentation for Babel
|
|||||||
Provides: python-babel-doc = %{version}-%{release}
|
Provides: python-babel-doc = %{version}-%{release}
|
||||||
Provides: python3-babel-doc = %{version}-%{release}
|
Provides: python3-babel-doc = %{version}-%{release}
|
||||||
Provides: babel-doc
|
Provides: babel-doc
|
||||||
Obsoletes: babel-doc < %{version}-%{release}
|
Obsoletes: babel-doc
|
||||||
|
|
||||||
%description help
|
%description help
|
||||||
Documentation for Babel
|
Documentation for Babel
|
||||||
@ -83,7 +82,7 @@ export TZ=UTC
|
|||||||
%postun
|
%postun
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc CHANGES.rst AUTHORS
|
%doc CHANGES AUTHORS
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%{_bindir}/pybabel
|
%{_bindir}/pybabel
|
||||||
|
|
||||||
@ -97,24 +96,6 @@ export TZ=UTC
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%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
|
* Fri Dec 3 2021 panxiaohe <panxiaohe@huawei.com> - 2.9.1-3
|
||||||
- add Bootstrap for Python 3.10
|
- add Bootstrap for Python 3.10
|
||||||
|
|
||||||
|
|||||||
@ -1,41 +0,0 @@
|
|||||||
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 d’Europe 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 d’Europe 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
|
|
||||||
|
|
||||||
@ -1,97 +0,0 @@
|
|||||||
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")
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user