me
/
guix
Archived
1
0
Fork 0

gnu: python-scipy: Update to 1.9.1.

* gnu/packages/python-science.scm (python-scipy): Update to 1.9.1.
[source]: Switch to GIT-FETCH.
[outputs]: Remove.
[arguments]: Don't disable Pythran.  Don't configure OpenBLAS which is now
discovered by pkg-config.  Do a "manual" PEP 517 style build.  Make
install-doc phase conditional on the presence of Sphinx.  Simplify tests.
[propagated-inputs]: Add PYTHON-PYTHRAN.
[native-inputs]: Remove PERL, WHICH, PYTHON-NUMPYDOC,
PYTHON-PYDATA-SPHINX-THEME, PYTHON-SPHINX, and PYTHON-SPHINX-PANELS.  Add
GCC, PKG-CONFIG, PYTHON-PYPA-BUILD and PYTHON-MESON.
master
Marius Bakke 2022-09-11 16:26:06 +02:00
parent 44d73b3370
commit 888dfc8eb6
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
1 changed files with 59 additions and 53 deletions

View File

@ -42,6 +42,7 @@
#:use-module (gnu packages base) #:use-module (gnu packages base)
#:use-module (gnu packages bioinformatics) #:use-module (gnu packages bioinformatics)
#:use-module (gnu packages boost) #:use-module (gnu packages boost)
#:use-module (gnu packages build-tools)
#:use-module (gnu packages check) #:use-module (gnu packages check)
#:use-module (gnu packages cpp) #:use-module (gnu packages cpp)
#:use-module (gnu packages databases) #:use-module (gnu packages databases)
@ -75,52 +76,60 @@
(define-public python-scipy (define-public python-scipy
(package (package
(name "python-scipy") (name "python-scipy")
(version "1.8.0") (version "1.9.1")
(source (source
(origin (origin
(method url-fetch) (method url-fetch)
(uri (pypi-uri "scipy" version)) (uri (pypi-uri "scipy" version))
(sha256 (sha256
(base32 "1gghkwn93niyasm36333xbqrnn3yiadq9d97wnc9mg14nzbg5m1i")))) (base32 "1jcb94xal7w7ax80kaivqqics36v8smi4a3xngyxbrh0i538rli6"))))
(outputs '("out" "doc"))
(build-system python-build-system) (build-system python-build-system)
(arguments (arguments
(list (list
#:modules '((guix build utils)
(guix build python-build-system)
(ice-9 format))
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'disable-pythran (add-after 'unpack 'loosen-requirements
(lambda _ (lambda _
(setenv "SCIPY_USE_PYTHRAN" "0"))) (substitute* "pyproject.toml"
(add-before 'build 'change-home-dir (("numpy==") "numpy>=")
(("meson==") "meson>="))))
(replace 'build
(lambda _ (lambda _
;; Change from /homeless-shelter to /tmp for write permission. ;; ZIP does not support timestamps before 1980.
(setenv "HOME" "/tmp"))) (setenv "SOURCE_DATE_EPOCH" "315532800")
(add-before 'build 'configure-openblas (invoke "python" "-m" "build" "--wheel" "--no-isolation" ".")))
(replace 'install
(lambda _ (lambda _
(call-with-output-file "site.cfg" (let ((whl (car (find-files "dist" "\\.whl$"))))
(lambda (port) (invoke "pip" "--no-cache-dir" "--no-input"
(format port "install" "--no-deps" "--prefix" #$output whl))))
"\ (replace 'check
[blas] (lambda* (#:key tests? #:allow-other-keys)
libraries = openblas (when tests?
library_dirs = ~a/lib ;; Step out of the source directory to avoid interference.
include_dirs = ~:*~a/include (with-directory-excursion "/tmp"
(invoke "python" "-c"
[atlas] (string-append
library_dirs = ~:*~a/lib "import scipy; scipy.test('fast', parallel="
atlas_libs = openblas~%" #$(this-package-input "openblas")))))) (number->string (parallel-job-count))
(add-before 'build 'parallelize-build ", verbose=2)"))))))
(lambda _ (add-after 'check 'install-doc
(setenv "NPY_NUM_BUILD_JOBS"
(number->string (parallel-job-count)))))
(add-before 'check 'install-doc
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((data (string-append (assoc-ref outputs "doc") "/share")) ;; FIXME: Documentation cannot be built because it requires
(doc (string-append data "/doc/" #$name "-" #$version)) ;; a newer version of pydata-sphinx-theme, which currently
(html (string-append doc "/html"))) ;; cannot build without internet access:
;; <https://github.com/pydata/pydata-sphinx-theme/issues/628>.
;; Keep the phase for easy testing.
(let ((sphinx-build (false-if-exception
(search-input-file input "bin/sphinx-build"))))
(if sphinx-build
(let* ((doc (assoc-ref outputs "doc"))
(data (string-append doc "/share"))
(docdir (string-append
data "/doc/"
#$(package-name this-package) "-"
#$(package-version this-package)))
(html (string-append docdir "/html")))
(with-directory-excursion "doc" (with-directory-excursion "doc"
;; Build doc. ;; Build doc.
(invoke "make" "html" (invoke "make" "html"
@ -130,26 +139,23 @@ atlas_libs = openblas~%" #$(this-package-input "openblas"))))))
(number->string (parallel-job-count)))) (number->string (parallel-job-count))))
;; Install doc. ;; Install doc.
(mkdir-p html) (mkdir-p html)
(copy-recursively "build/html" html))))) (copy-recursively "build/html" html)))
(replace 'check (format #t "sphinx-build not found, skipping~%"))))))))
(lambda* (#:key tests? #:allow-other-keys) (propagated-inputs
(when tests? (list python-numpy python-matplotlib python-pyparsing python-pythran))
(invoke "./runtests.py" "-vv" "--no-build" "--mode=fast"
"-j" (number->string (parallel-job-count)))))))))
(propagated-inputs (list python-numpy python-matplotlib python-pyparsing))
(inputs (list openblas pybind11)) (inputs (list openblas pybind11))
(native-inputs (native-inputs
(list gfortran (list gfortran
perl ;; XXX: Adding gfortran shadows GCC headers, causing a compilation
;; failure. Somehow also providing GCC works around it ...
gcc
meson-python
pkg-config
python-cython python-cython
python-numpydoc python-pypa-build
python-pydata-sphinx-theme
python-pytest python-pytest
python-pytest-xdist python-pytest-xdist
python-sphinx python-threadpoolctl))
python-sphinx-panels
python-threadpoolctl
which))
(home-page "https://scipy.org/") (home-page "https://scipy.org/")
(synopsis "The Scipy library provides efficient numerical routines") (synopsis "The Scipy library provides efficient numerical routines")
(description "The SciPy library is one of the core packages that make up (description "The SciPy library is one of the core packages that make up