2 Commits

3 changed files with 31 additions and 0 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Jul 23 06:34:38 UTC 2025 - Bernhard Wiedemann <bwiedemann@suse.de>
- Add reproducible.patch to normalize date in .po (boo#1047218)
-------------------------------------------------------------------
Mon Feb 3 13:38:56 UTC 2025 - Dirk Müller <dmueller@suse.com>

View File

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

24
reproducible.patch Normal file
View File

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