Source: matplotlib
Severity: normal
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

The build date is embedded in copyright statements in various .html
documentation:

  
https://tests.reproducible-builds.org/debian/rb-pkg/bullseye/amd64/diffoscope-results/matplotlib.html

  ./usr/share/doc/python-matplotlib-doc/html/users/whats_new_old.html

  
©·Copyright·2021·-·2012·John·Hunter...·2012·-·2021·The·Matplotlib·development·team.
  vs.
  
©·Copyright·2021·-·2012·John·Hunter...·2012·-·2022·The·Matplotlib·development·team.

The attached patch fixes this by patching doc/conf.py to respect
SOURCE_DATE_EPOCH, which is set by dpkg during package builds.


Arguably, dynamically generating the copyright dates during the build is
not correct behavior; no new copyrighted material was generated as a
result of the building at a later date.


This patch does not fix all reproducibility issues in matplotlib, but it
should reduce the overall diff.


Thanks for maintaining matplotlib!


live well,
  vagrant
From 94c1a1387f88279e31808ad3a9f08270f3e3d37b Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Sat, 26 Jun 2021 03:12:37 +0000
Subject: [PATCH] doc/conf.py: if set, use SOURCE_DATE_EPOCH to set copyright
 year.

The build date of the software shouldn't really have any bearing on
the copyright dates, but by respecting SOURCE_DATE_EPOCH, it at least
limits this to the last time something in the source was changed.

https://reproducible-builds.org/specs/source-date-epoch/
---
 doc/conf.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/doc/conf.py b/doc/conf.py
index 174c8935..06d5534c 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -18,6 +18,11 @@ import matplotlib
 import sphinx
 
 from datetime import datetime
+import time
+
+# Parse year using SOURCE_DATE_EPOCH, falling back to current time.
+# https://reproducible-builds.org/specs/source-date-epoch/
+sourceyear=datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))).year
 
 # If your extensions are in another directory, add it here. If the directory
 # is relative to the documentation root, use os.path.abspath to make it
@@ -189,7 +194,7 @@ html_context = {'sha': SHA}
 project = 'Matplotlib'
 copyright = ('2002 - 2012 John Hunter, Darren Dale, Eric Firing, '
              'Michael Droettboom and the Matplotlib development '
-             f'team; 2012 - {datetime.now().year} The Matplotlib development team')
+             f'team; 2012 - {sourceyear} The Matplotlib development team')
 
 
 # The default replacements for |version| and |release|, also used in various
-- 
2.32.0

Attachment: signature.asc
Description: PGP signature

Reply via email to