gnu: python: Set source file times to 1980 to fix test.

* gnu/packages/python.scm (python-2)[arguments]: Use 'modify-phases'.  Return
  true from phases where needed.  Add 'set-source-file-times-to-1980' phase.
  Add (ice-9 ftw) to #:modules.
This commit is contained in:
Mark H Weaver 2015-07-15 13:31:51 -04:00
parent c09e6a5f5e
commit 46472ecd00
1 changed files with 33 additions and 17 deletions

View File

@ -155,24 +155,40 @@
"-L" zlib "/lib " "-L" zlib "/lib "
"-Wl,-rpath=" out "/lib"))) "-Wl,-rpath=" out "/lib")))
#:modules ((ice-9 ftw)
,@%gnu-build-system-modules)
#:phases #:phases
(alist-cons-before (modify-phases %standard-phases
'configure 'patch-lib-shells (add-before
(lambda _ 'configure 'patch-lib-shells
;; Filter for existing files, since some may not exist in all (lambda _
;; versions of python that are built with this recipe. ;; Filter for existing files, since some may not exist in all
(substitute* (filter file-exists? ;; versions of python that are built with this recipe.
'("Lib/subprocess.py" (substitute* (filter file-exists?
"Lib/popen2.py" '("Lib/subprocess.py"
"Lib/distutils/tests/test_spawn.py" "Lib/popen2.py"
"Lib/test/test_subprocess.py")) "Lib/distutils/tests/test_spawn.py"
(("/bin/sh") (which "sh")))) "Lib/test/test_subprocess.py"))
(alist-cons-before (("/bin/sh") (which "sh")))
'check 'pre-check #t))
(lambda _ (add-before
;; 'Lib/test/test_site.py' needs a valid $HOME 'check 'pre-check
(setenv "HOME" (getcwd))) (lambda _
%standard-phases)))) ;; 'Lib/test/test_site.py' needs a valid $HOME
(setenv "HOME" (getcwd))
#t))
(add-after
'unpack 'set-source-file-times-to-1980
;; XXX One of the tests uses a ZIP library to pack up some of the
;; source tree, and fails with "ZIP does not support timestamps
;; before 1980". Work around this by setting the file times in the
;; source tree to sometime in early 1980.
(lambda _
(let ((circa-1980 (* 10 366 24 60 60)))
(ftw "." (lambda (file stat flag)
(utime file circa-1980 circa-1980)
#t))
#t))))))
(inputs (inputs
`(("bzip2" ,bzip2) `(("bzip2" ,bzip2)
("gdbm" ,gdbm) ("gdbm" ,gdbm)