[Python-modules-commits] r33386 - in packages/sphinx/trunk/debian (3 files)

mitya57 at users.alioth.debian.org mitya57 at users.alioth.debian.org
Sat Jul 18 10:23:31 UTC 2015


    Date: Saturday, July 18, 2015 @ 10:23:30
  Author: mitya57
Revision: 33386

Add support for $SOURCE_DATE_EPOCH environment variable, to make
the documentation builds reproducible (source_date_epoch.diff).

Added:
  packages/sphinx/trunk/debian/patches/source_date_epoch.diff
Modified:
  packages/sphinx/trunk/debian/changelog
  packages/sphinx/trunk/debian/patches/series

Modified: packages/sphinx/trunk/debian/changelog
===================================================================
--- packages/sphinx/trunk/debian/changelog	2015-07-18 10:15:53 UTC (rev 33385)
+++ packages/sphinx/trunk/debian/changelog	2015-07-18 10:23:30 UTC (rev 33386)
@@ -3,6 +3,8 @@
   * Update debian/TODO with the actual information.
   * Backport upstream patch to disable warning about renamed default theme
     (no_theme_rename_warning.diff).
+  * Add support for $SOURCE_DATE_EPOCH environment variable, to make
+    the documentation builds reproducible (source_date_epoch.diff).
 
  -- Dmitry Shachnev <mitya57 at debian.org>  Sat, 18 Jul 2015 12:22:01 +0300
 

Modified: packages/sphinx/trunk/debian/patches/series
===================================================================
--- packages/sphinx/trunk/debian/patches/series	2015-07-18 10:15:53 UTC (rev 33385)
+++ packages/sphinx/trunk/debian/patches/series	2015-07-18 10:23:30 UTC (rev 33386)
@@ -5,3 +5,4 @@
 no_snowballstemmer.diff
 py35compat.diff
 no_theme_rename_warning.diff
+source_date_epoch.diff

Added: packages/sphinx/trunk/debian/patches/source_date_epoch.diff
===================================================================
--- packages/sphinx/trunk/debian/patches/source_date_epoch.diff	                        (rev 0)
+++ packages/sphinx/trunk/debian/patches/source_date_epoch.diff	2015-07-18 10:23:30 UTC (rev 33386)
@@ -0,0 +1,35 @@
+Description: add support for $SOURCE_DATE_EPOCH env variable
+Author: Dmitry Shachnev <mitya57 at debian.org>
+Forwarded: https://github.com/sphinx-doc/sphinx/pull/1954
+Last-Update: 2015-07-18
+
+--- a/sphinx/util/osutil.py
++++ b/sphinx/util/osutil.py
+@@ -151,15 +151,23 @@
+ def make_filename(string):
+     return no_fn_re.sub('', string) or 'sphinx'
+ 
+-if PY2:
++
++def ustrftime(format, *args):
+     # strftime for unicode strings
+-    def ustrftime(format, *args):
++    if not args:
++        # If time is not specified, try to use $SOURCE_DATE_EPOCH variable
++        # See https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal
++        source_date_epoch = os.getenv('SOURCE_DATE_EPOCH')
++        if source_date_epoch is not None:
++            time_struct = time.gmtime(float(source_date_epoch))
++            args = [time_struct]
++    if PY2:
+         # if a locale is set, the time strings are encoded in the encoding
+         # given by LC_TIME; if that is available, use it
+         enc = locale.getlocale(locale.LC_TIME)[1] or 'utf-8'
+         return time.strftime(text_type(format).encode(enc), *args).decode(enc)
+-else:
+-    ustrftime = time.strftime
++    else:
++        return time.strftime(format, *args)
+ 
+ 
+ def safe_relpath(path, start=None):




More information about the Python-modules-commits mailing list