From d504784754d0cb4b0c7f638b0d34a2960abe7626678352cde76a98be039f1d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Sat, 26 Jul 2025 05:15:02 +0000 Subject: [PATCH] Accepting request 1295211 from home:bmwiedemann:reproducible:test Add reproducible.patch to normalize date in .po (boo#1047218) not sure how easy it is to get upstream. There is some poor interaction of this variable with freeze_gun tests. OBS-URL: https://build.opensuse.org/request/show/1295211 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Babel?expand=0&rev=91 --- python-Babel.changes | 5 +++++ python-Babel.spec | 2 ++ reproducible.patch | 24 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 reproducible.patch diff --git a/python-Babel.changes b/python-Babel.changes index cf986ac..933c55d 100644 --- a/python-Babel.changes +++ b/python-Babel.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Jul 23 06:34:38 UTC 2025 - Bernhard Wiedemann + +- Add reproducible.patch to normalize date in .po (boo#1047218) + ------------------------------------------------------------------- Mon Feb 3 13:38:56 UTC 2025 - Dirk Müller diff --git a/python-Babel.spec b/python-Babel.spec index 6123dbf..aa7b6fc 100644 --- a/python-Babel.spec +++ b/python-Babel.spec @@ -32,6 +32,7 @@ Summary: Internationalization utilities License: BSD-3-Clause URL: https://babel.pocoo.org/ Source: https://files.pythonhosted.org/packages/source/b/babel/babel-%{version}.tar.gz +Patch0: reproducible.patch BuildRequires: %{python_module freezegun >= 1.0} BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest >= 6.0} @@ -73,6 +74,7 @@ A collection of tools for internationalizing Python applications. %python_expand %fdupes %{buildroot}%{$python_sitelib} %check +unset SOURCE_DATE_EPOCH %pytest %pre diff --git a/reproducible.patch b/reproducible.patch new file mode 100644 index 0000000..9fc4445 --- /dev/null +++ b/reproducible.patch @@ -0,0 +1,24 @@ +diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py +index f84a5bd..786d1a4 100644 +--- a/babel/messages/catalog.py ++++ b/babel/messages/catalog.py +@@ -11,6 +11,8 @@ from __future__ import annotations + + import datetime + import re ++import time ++import os + from collections.abc import Iterable, Iterator + from copy import copy + from difflib import SequenceMatcher +@@ -385,7 +387,9 @@ class Catalog: + self.charset = charset or 'utf-8' + + if creation_date is None: +- creation_date = datetime.datetime.now(LOCALTZ) ++ creation_date = datetime.datetime.utcfromtimestamp( ++ int(os.environ.get('SOURCE_DATE_EPOCH', time.time())) ++ ) + elif isinstance(creation_date, datetime.datetime) and not creation_date.tzinfo: + creation_date = creation_date.replace(tzinfo=LOCALTZ) + self.creation_date = creation_date