Description: Make the build reproducible
Author: Chris Lamb <lamby@debian.org>
Forwarded: not-needed
Last-Update: 2024-03-11

--- python-quantities-0.15.0.orig/setup.py
+++ python-quantities-0.15.0/setup.py
@@ -1,8 +1,14 @@
+import os
+import time
 from setuptools import Command, setup
 from setuptools.command.build_py import build_py as _build
 from setuptools.command.sdist import sdist as _sdist
-from datetime import datetime
+from datetime import datetime, timezone
 
+build_date = datetime.fromtimestamp(
+    int(os.environ.get('SOURCE_DATE_EPOCH', time.time())),
+    tz=timezone.utc,
+)
 
 class data(Command):
 
@@ -24,7 +30,7 @@ class data(Command):
         with open('quantities/constants/_codata.py', 'w') as f:
             f.write('# THIS FILE IS AUTOMATICALLY GENERATED\n')
             f.write('# ANY CHANGES MADE HERE WILL BE LOST\n')
-            f.write(f'# LAST GENERATED: {datetime.now()}\n\n')
+            f.write(f'# LAST GENERATED: {build_date}\n\n')
             f.write('physical_constants = {}\n\n')
             for line in data:
                 name = line[:55].rstrip().replace('mag.','magnetic')
