From dedc8320701b3f5d23ccc213c1c0381e00b33785 Mon Sep 17 00:00:00 2001
From: Ludovic Courtès <ludo@gnu.org>
Date: Sat, 14 Nov 2015 00:08:35 +0100
Subject: gnu: python-2: Honor 'SOURCE_DATE_EPOCH'.

* gnu/packages/patches/python-2.7-source-date-epoch.patch: New file.
* gnu/packages/python.scm (python-2)[source]: Use it.
  [arguments]: Set SOURCE_DATE_EPOCH in 'patch-lib-shells' phase.
* guix/build/python-build-system.scm (set-SOURCE-DATE-EPOCH): New
  procedure.
  (%standard-phases): Add it.
* gnu-system.am (dist_patch_DATA): Add patch.
---
 gnu/packages/python.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'gnu/packages/python.scm')

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 001d00e9be..07725c727a 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -92,7 +92,9 @@ (define-public python-2
       (sha256
        (base32
         "1h7zbrf9pkj29hlm18b10548ch9757f75m64l47sy75rh43p7lqw"))
-      (patches (list (search-patch "python-2.7-search-paths.patch")))))
+      (patches (map search-patch
+                    '("python-2.7-search-paths.patch"
+                      "python-2.7-source-date-epoch.patch")))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f
@@ -158,6 +160,11 @@ (define-public python-2
                                     "Lib/distutils/tests/test_spawn.py"
                                     "Lib/test/test_subprocess.py"))
                (("/bin/sh") (which "sh")))
+
+             ;; Use zero as the timestamp in .pyc files so that builds are
+             ;; deterministic.  TODO: Remove it when this variable is set in
+             ;; gnu-build-system.scm.
+             (setenv "SOURCE_DATE_EPOCH" "0")
              #t))
           (add-before
            'check 'pre-check
-- 
cgit v1.2.3