gnu: python-numpy: Reorganize patches.

* gnu/packages/python.scm (python-numpy)[arguments]<phases>: Delete phase
"set-environment-variables".
Add phase "configure-blas-lapack". Move phase "check" after phase "install".
This commit is contained in:
Konrad Hinsen 2017-12-20 17:18:56 +01:00 committed by Danny Milosavljevic
parent 916bb9470a
commit e144cbcf85
No known key found for this signature in database
GPG Key ID: E71A35542C30BAA5
1 changed files with 33 additions and 30 deletions

View File

@ -2619,12 +2619,12 @@ between language specification and implementation aspects.")
(arguments (arguments
`(#:phases `(#:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(add-before 'build 'set-environment-variables (add-before 'build 'configure-blas-lapack
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(call-with-output-file "site.cfg" (call-with-output-file "site.cfg"
(lambda (port) (lambda (port)
(format port (format port
"[openblas] "[openblas]
libraries = openblas libraries = openblas
library_dirs = ~a/lib library_dirs = ~a/lib
include_dirs = ~a/include include_dirs = ~a/include
@ -2635,30 +2635,33 @@ lapack_libs = lapack
library_dirs = ~a/lib library_dirs = ~a/lib
include_dirs = ~a/include include_dirs = ~a/include
" "
(assoc-ref inputs "openblas") (assoc-ref inputs "openblas")
(assoc-ref inputs "openblas") (assoc-ref inputs "openblas")
(assoc-ref inputs "lapack") (assoc-ref inputs "lapack")
(assoc-ref inputs "lapack")))) (assoc-ref inputs "lapack"))))
;; Make /gnu/store/...-bash-.../bin/sh the default shell, instead of #t))
;; /bin/sh. (add-before 'build 'fix-executable-paths
(substitute* "numpy/distutils/exec_command.py" (lambda* (#:key inputs #:allow-other-keys)
(("(os.environ.get\\('SHELL', ')(/bin/sh'\\))" match match-start match-end) ;; Make /gnu/store/...-bash-.../bin/sh the default shell,
(string-append match-start (assoc-ref inputs "bash") match-end))) ;; instead of /bin/sh.
;; Use "gcc" executable, not "cc". (substitute* "numpy/distutils/exec_command.py"
(substitute* "numpy/distutils/system_info.py" (("(os.environ.get\\('SHELL', ')(/bin/sh'\\))" match match-start match-end)
(("c = distutils\\.ccompiler\\.new_compiler\\(\\)") (string-append match-start (assoc-ref inputs "bash") match-end)))
"c = distutils.ccompiler.new_compiler(); c.set_executables(compiler='gcc',compiler_so='gcc',linker_exe='gcc',linker_so='gcc -shared')")) ;; Use "gcc" executable, not "cc".
#t)) (substitute* "numpy/distutils/system_info.py"
;; Tests can only be run after the library has been installed and not (("c = distutils\\.ccompiler\\.new_compiler\\(\\)")
;; within the source directory. "c = distutils.ccompiler.new_compiler(); c.set_executables(compiler='gcc',compiler_so='gcc',linker_exe='gcc',linker_so='gcc -shared')"))
(delete 'check) #t))
(add-after 'install 'check ;; Tests can only be run after the library has been installed and not
(lambda* (#:key outputs inputs #:allow-other-keys) ;; within the source directory.
;; Make installed package available for running the tests (delete 'check)
(add-installed-pythonpath inputs outputs) (add-after 'install 'check
(with-directory-excursion "/tmp" (lambda* (#:key outputs inputs #:allow-other-keys)
(zero? (system* "python" "-c" ;; Make installed package available for running the tests
"import numpy; numpy.test(verbose=2)")))))))) (add-installed-pythonpath inputs outputs)
(with-directory-excursion "/tmp"
(zero? (system* "python" "-c"
"import numpy; numpy.test(verbose=2)"))))))))
(home-page "http://www.numpy.org/") (home-page "http://www.numpy.org/")
(synopsis "Fundamental package for scientific computing with Python") (synopsis "Fundamental package for scientific computing with Python")
(description "NumPy is the fundamental package for scientific computing (description "NumPy is the fundamental package for scientific computing