From 85e027fdb66666747d8a2310321c02d10ee9796c Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Fri, 21 Oct 2022 16:13:23 +0800 Subject: [PATCH] Fix unit test timezone bug --- ...-date-times-indepentent-of-time-zone.patch | 37 +++++++++++++++++++ babel.spec | 6 ++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 Parse-string-date-times-indepentent-of-time-zone.patch diff --git a/Parse-string-date-times-indepentent-of-time-zone.patch b/Parse-string-date-times-indepentent-of-time-zone.patch new file mode 100644 index 0000000..c0f086d --- /dev/null +++ b/Parse-string-date-times-indepentent-of-time-zone.patch @@ -0,0 +1,37 @@ +From 9d6803a2700df9228f0b6a9614ec7a44a3ad27bb Mon Sep 17 00:00:00 2001 +From: rachele-collin <63007243+rachele-collin@users.noreply.github.com> +Date: Wed, 1 Apr 2020 18:05:11 +0200 +Subject: [PATCH] Parse string date times indepentent of time zone + +Parsing a date time string (such as for ``POT-Creation-Date`` or +``PO-Revision-Date``) as UTC time, in particular independent of the +local time zone. + +Closes: #700 +--- + babel/messages/catalog.py | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py +index e516fd8ca..342f7377b 100644 +--- a/babel/messages/catalog.py ++++ b/babel/messages/catalog.py +@@ -10,7 +10,6 @@ + """ + + import re +-import time + + from cgi import parse_header + from collections import OrderedDict +@@ -43,9 +42,7 @@ + def _parse_datetime_header(value): + match = re.match(r'^(?P.*?)(?P[+-]\d{4})?$', value) + +- tt = time.strptime(match.group('datetime'), '%Y-%m-%d %H:%M') +- ts = time.mktime(tt) +- dt = datetime.fromtimestamp(ts) ++ dt = datetime.strptime(match.group('datetime'), '%Y-%m-%d %H:%M') + + # Separate the offset into a sign component, hours, and # minutes + tzoffset = match.group('tzoffset') diff --git a/babel.spec b/babel.spec index 02ca320..274163f 100644 --- a/babel.spec +++ b/babel.spec @@ -1,6 +1,6 @@ Name: babel Version: 2.8.0 -Release: 4 +Release: 5 Summary: Tools for internationalizing and localizing Python applications License: BSD URL: http://babel.pocoo.org/ @@ -13,6 +13,7 @@ Patch5: stop-using-deprecated-ElementTree-methods-getchildre.patch Patch6: backport-0001-CVE-2021-20095-Run-locale-identifiers-through-os.path.basename.patch Patch7: backport-0002-CVE-2021-20095-Disallow-special-filenames-on-Windows.patch Patch8: babel-fix-integers-for-future-flags.patch +Patch9: Parse-string-date-times-indepentent-of-time-zone.patch BuildArch: noarch @@ -87,6 +88,9 @@ export TZ=Asia/Shanghai %doc built-docs/html/* %changelog +* Fri Oct 21 2022 wangxiyuan - 2.8.0-5 +- Fix unit test timezone bug + * Wed Jan 26 2022 zhangy1317 - 2.8.0-4 - Remove python2 and fix tests when using Python 3.9 -- Gitee