File: reproducible_documentation.patch

package info (click to toggle)
basemap 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 213,536 kB
  • sloc: python: 11,826; sh: 45; makefile: 41
file content (75 lines) | stat: -rw-r--r-- 2,859 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
From: Juan Picca <jumapico@gmail.com>
Date: Wed, 13 Mar 2024 11:24:26 +0100
Subject: Make documentation reproducible

Bug-Debian: https://bugs.debian.org/790235
Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=790235;filename=0001-make-images-reproducible.patch;msg=35
Last-Update: 2025-11-03
Forwarded: https://github.com/matplotlib/basemap/pull/641
---
 doc/make.py                                  | 2 +-
 doc/source/users/figures/plotdaynight.py     | 7 +++++--
 doc/source/users/figures/plothighsandlows.py | 5 ++++-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/doc/make.py b/doc/make.py
index acf1723..8fb8953 100755
--- a/doc/make.py
+++ b/doc/make.py
@@ -7,7 +7,7 @@ import shutil
 import sys
 
 def html():
-    os.system('sphinx-build -b html -d build/doctrees . build/html')
+    os.system('LC_ALL=C.UTF-8 sphinx-build -b html -c source/ -d build/doctrees . build/html')
 
 def latex():
     if sys.platform != 'win32':
diff --git a/doc/source/users/figures/plotdaynight.py b/doc/source/users/figures/plotdaynight.py
index ac1f7bc..1cd20b9 100644
--- a/doc/source/users/figures/plotdaynight.py
+++ b/doc/source/users/figures/plotdaynight.py
@@ -1,7 +1,9 @@
+import os
+import time
+import datetime
 import numpy as np
 from mpl_toolkits.basemap import Basemap
 import matplotlib.pyplot as plt
-from datetime import datetime
 # miller projection 
 map = Basemap(projection='mill',lon_0=180)
 # plot coastlines, draw label meridians and parallels.
@@ -13,7 +15,8 @@ map.drawmapboundary(fill_color='aqua')
 map.fillcontinents(color='coral',lake_color='aqua')
 # shade the night areas, with alpha transparency so the 
 # map shows through. Use current time in UTC.
-date = datetime.utcnow()
+date = datetime.datetime.utcfromtimestamp(
+        int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
 CS=map.nightshade(date)
 plt.title('Day/Night Map for %s (UTC)' % date.strftime("%d %b %Y %H:%M:%S"))
 plt.show()
diff --git a/doc/source/users/figures/plothighsandlows.py b/doc/source/users/figures/plothighsandlows.py
index d9e70bb..9a8d5d2 100644
--- a/doc/source/users/figures/plothighsandlows.py
+++ b/doc/source/users/figures/plothighsandlows.py
@@ -3,6 +3,8 @@ plot H's and L's on a sea-level pressure map
 (uses scipy.ndimage.filters and netcdf4-python)
 """
 import datetime as dt
+import os
+import time
 import numpy as np
 import matplotlib.pyplot as plt
 from mpl_toolkits.basemap import Basemap, addcyclic
@@ -23,7 +25,8 @@ def extrema(mat,mode='wrap',window=10):
 
 # Plot 00 UTC yesterday.
 url = "http://nomads.ncep.noaa.gov/dods/gfs_0p50/gfs%Y%m%d/gfs_0p50_00z"
-date = dt.datetime.now() - dt.timedelta(days=1)
+now = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
+date = dt.datetime.utcfromtimestamp(now) - dt.timedelta(days=1)
 
 # open OpenDAP dataset.
 data = Dataset(date.strftime(url))