gnu: python-matplotlib: Update to 3.5.1 and run tests in parallel.
* gnu/packages/python-xyz.scm (python-matplotlib): Update to 3.5.1. [propagated-inputs]: Add python-fonttools, python-wxpython and python-packaging. [native-inputs]: Remove python-mock, python-wheel, unzip and jquery-ui. Add python-pytest-timeout, python-pytest-xdist, python-setuptools-scm and python-setuptools-scm-git-archive. [phases]: Delete trailing #t. {pretend-version}: New phase. {install-jquery-ui}: Delete phase. {check}: Honor TESTS?. Do not skip webagg tests anymore. Invoke using '-n' argument to run tests in parallel via pytest-xdist. {configure-environment}: Do not set LD_LIBRARY_PATH nor HOME. Rename setup.cfg to mplsetup.cfg. Set the backend to Agg.
This commit is contained in:
parent
e5e533c221
commit
ea0ed65c59
1 changed files with 79 additions and 90 deletions
|
@ -6215,17 +6215,19 @@ comparison.
|
||||||
(define-public python-matplotlib
|
(define-public python-matplotlib
|
||||||
(package
|
(package
|
||||||
(name "python-matplotlib")
|
(name "python-matplotlib")
|
||||||
(version "3.4.3")
|
(version "3.5.1")
|
||||||
(source
|
(source
|
||||||
(origin
|
(origin
|
||||||
(method url-fetch)
|
(method url-fetch)
|
||||||
(uri (pypi-uri "matplotlib" version))
|
(uri (pypi-uri "matplotlib" version))
|
||||||
(sha256
|
(sha256
|
||||||
(base32 "06032j0ccjxldx4z9kf97qps2g36mfgvy1nap3b9n75kzmnm4kzw"))))
|
(base32 "076f8qi265x8jy89c03r3vv5h4is4ir5mawwrrrpp96314783sdj"))))
|
||||||
(build-system python-build-system)
|
(build-system python-build-system)
|
||||||
(propagated-inputs ; the following packages are all needed at run time
|
(propagated-inputs ; the following packages are all needed at run time
|
||||||
`(("python-cycler" ,python-cycler)
|
`(("python-cycler" ,python-cycler)
|
||||||
|
("python-fonttools" ,python-fonttools)
|
||||||
("python-kiwisolver" ,python-kiwisolver)
|
("python-kiwisolver" ,python-kiwisolver)
|
||||||
|
("python-packaging" ,python-packaging)
|
||||||
("python-pyparsing" ,python-pyparsing)
|
("python-pyparsing" ,python-pyparsing)
|
||||||
("python-pygobject" ,python-pygobject)
|
("python-pygobject" ,python-pygobject)
|
||||||
("python-certifi" ,python-certifi)
|
("python-certifi" ,python-certifi)
|
||||||
|
@ -6236,6 +6238,7 @@ comparison.
|
||||||
("python-pillow" ,python-pillow)
|
("python-pillow" ,python-pillow)
|
||||||
("python-pytz" ,python-pytz)
|
("python-pytz" ,python-pytz)
|
||||||
("python-six" ,python-six)
|
("python-six" ,python-six)
|
||||||
|
("python-wxpython" ,python-wxpython)
|
||||||
;; From version 1.4.0 'matplotlib' makes use of 'cairocffi' instead of
|
;; From version 1.4.0 'matplotlib' makes use of 'cairocffi' instead of
|
||||||
;; 'pycairo'. However, 'pygobject' makes use of a 'pycairo' 'context'
|
;; 'pycairo'. However, 'pygobject' makes use of a 'pycairo' 'context'
|
||||||
;; object. For this reason we need to import both libraries.
|
;; object. For this reason we need to import both libraries.
|
||||||
|
@ -6248,101 +6251,87 @@ comparison.
|
||||||
qhull
|
qhull
|
||||||
cairo
|
cairo
|
||||||
glib
|
glib
|
||||||
;; FIXME: Add backends when available.
|
|
||||||
;("python-wxpython" ,python-wxpython)
|
|
||||||
tcl
|
tcl
|
||||||
tk))
|
tk))
|
||||||
(native-inputs
|
(native-inputs
|
||||||
`(("pkg-config" ,pkg-config)
|
`(("pkg-config" ,pkg-config)
|
||||||
("python-pytest" ,python-pytest)
|
("python-pytest" ,python-pytest)
|
||||||
("python-mock" ,python-mock)
|
("python-pytest-timeout" ,python-pytest-timeout)
|
||||||
("python-wheel" ,python-wheel)
|
("python-pytest-xdist" ,python-pytest-xdist)
|
||||||
("unzip" ,unzip)
|
("python-setuptools-scm" ,python-setuptools-scm)
|
||||||
("jquery-ui"
|
("python-setuptools-scm-git-archive" ,python-setuptools-scm-git-archive)))
|
||||||
,(origin
|
|
||||||
(method url-fetch)
|
|
||||||
(uri "https://jqueryui.com/resources/download/jquery-ui-1.12.1.zip")
|
|
||||||
(sha256
|
|
||||||
(base32
|
|
||||||
"0kb21xf38diqgxcdi1z3s9ssq36pldvyqxy56hn6pcva6rs3c8zq"))))))
|
|
||||||
(arguments
|
(arguments
|
||||||
`(#:phases
|
(list
|
||||||
(modify-phases %standard-phases
|
#:phases
|
||||||
;; XXX We disable all image comparison tests because we're using a
|
#~(modify-phases %standard-phases
|
||||||
;; newer version of FreeType than matplotlib expects. This leads to
|
(add-before 'build 'pretend-version
|
||||||
;; minor differences throughout the tests.
|
;; The version string is usually derived via setuptools-scm, but
|
||||||
(add-after 'unpack 'fix-and-disable-failing-tests
|
;; without the git metadata available, the version string is set to
|
||||||
(lambda _
|
;; '0.0.0'.
|
||||||
(substitute* (append (find-files "lib/matplotlib/tests/"
|
(lambda _
|
||||||
"test_.*\\.py$")
|
(setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)))
|
||||||
(find-files "lib/mpl_toolkits/tests"
|
(add-after 'unpack 'fix-and-disable-failing-tests
|
||||||
"test_.*\\.py$"))
|
;; XXX: Disable all image comparison tests because we're using a
|
||||||
(("^from matplotlib" match)
|
;; newer version of FreeType than matplotlib expects. This leads
|
||||||
(string-append "import pytest\n" match))
|
;; to minor differences throughout the tests.
|
||||||
(("( *)@([^_]+_)*(image_comparison|check_figures_equal)" match
|
(lambda _
|
||||||
indent)
|
(substitute* (append (find-files "lib/matplotlib/tests/"
|
||||||
(string-append indent
|
"test_.*\\.py$")
|
||||||
"@pytest.mark.skip(reason=\"unknown minor image differences\")\n"
|
(find-files "lib/mpl_toolkits/tests"
|
||||||
match)))
|
"test_.*\\.py$"))
|
||||||
(substitute* "lib/matplotlib/tests/test_animation.py"
|
(("^from matplotlib" match)
|
||||||
(("/bin/sh") (which "sh")))
|
(string-append "import pytest\n" match))
|
||||||
(for-each delete-file
|
(("( *)@([^_]+_)*(image_comparison|check_figures_equal)" match
|
||||||
;; test_normal_axes, test_get_tightbbox_polar
|
indent)
|
||||||
'("lib/matplotlib/tests/test_axes.py"
|
(string-append indent "@pytest.mark.skip(\
|
||||||
"lib/matplotlib/tests/test_polar.py"
|
reason=\"unknown minor image differences\")\n" match)))
|
||||||
;; We don't use the webagg backend and this test
|
(substitute* "lib/matplotlib/tests/test_animation.py"
|
||||||
;; forces it.
|
(("/bin/sh") (which "sh")))
|
||||||
"lib/matplotlib/tests/test_backend_webagg.py"
|
(for-each delete-file
|
||||||
;; test_outward_ticks
|
;; test_normal_axes, test_get_tightbbox_polar
|
||||||
"lib/matplotlib/tests/test_tightlayout.py"
|
'("lib/matplotlib/tests/test_axes.py"
|
||||||
;; test_hidden_axes fails with minor extent
|
"lib/matplotlib/tests/test_polar.py"
|
||||||
;; differences, possibly due to the use of a
|
;; We don't use the webagg backend and this test
|
||||||
;; different version of FreeType.
|
;; forces it.
|
||||||
"lib/matplotlib/tests/test_constrainedlayout.py"
|
"lib/matplotlib/tests/test_backend_webagg.py"
|
||||||
;; Fontconfig returns no fonts.
|
;; test_outward_ticks
|
||||||
"lib/matplotlib/tests/test_font_manager.py"))
|
"lib/matplotlib/tests/test_tightlayout.py"
|
||||||
#t))
|
;; test_hidden_axes fails with minor extent
|
||||||
(add-before 'install 'install-jquery-ui
|
;; differences, possibly due to the use of a
|
||||||
(lambda* (#:key outputs inputs #:allow-other-keys)
|
;; different version of FreeType.
|
||||||
(let* ((python-version (python-version
|
"lib/matplotlib/tests/test_constrainedlayout.py"
|
||||||
(assoc-ref inputs "python")))
|
;; Fontconfig returns no fonts.
|
||||||
(dir
|
"lib/matplotlib/tests/test_font_manager.py"))))
|
||||||
(string-append (assoc-ref outputs "out")
|
(add-before 'build 'configure-environment
|
||||||
"/lib/python" python-version
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
"/site-packages"
|
;; Fix rounding errors when using the x87 FPU.
|
||||||
"/matplotlib/backends/web_backend/")))
|
(when (string-prefix? "i686" #$(%current-system))
|
||||||
(mkdir-p dir)
|
(setenv "CFLAGS" "-ffloat-store"))
|
||||||
(invoke "unzip"
|
(call-with-output-file "mplsetup.cfg"
|
||||||
(assoc-ref inputs "jquery-ui")
|
(lambda (port)
|
||||||
"-d" dir))
|
(format port "\
|
||||||
#t))
|
[libs]
|
||||||
(replace 'check
|
|
||||||
(lambda* (#:key outputs inputs #:allow-other-keys)
|
|
||||||
(add-installed-pythonpath inputs outputs)
|
|
||||||
(invoke "python" "tests.py" "-v"
|
|
||||||
"-m" "not network and not webagg")))
|
|
||||||
(add-before 'build 'configure-environment
|
|
||||||
(lambda* (#:key outputs inputs #:allow-other-keys)
|
|
||||||
(let ((cairo (assoc-ref inputs "cairo")))
|
|
||||||
;; Setting this directory in the 'basedirlist' of 'setup.cfg'
|
|
||||||
;; has not effect.
|
|
||||||
(setenv "LD_LIBRARY_PATH" (string-append cairo "/lib"))
|
|
||||||
(setenv "HOME" (getcwd))
|
|
||||||
;; Fix rounding errors when using the x87 FPU.
|
|
||||||
(when (string-prefix? "i686" ,(%current-system))
|
|
||||||
(setenv "CFLAGS" "-ffloat-store"))
|
|
||||||
(call-with-output-file "setup.cfg"
|
|
||||||
(lambda (port)
|
|
||||||
(format port "[libs]~%
|
|
||||||
system_freetype = true
|
system_freetype = true
|
||||||
system_qhull = true
|
system_qhull = true
|
||||||
[directories]~%
|
|
||||||
basedirlist = ~a,~a~%
|
[rc_options]
|
||||||
[packages]~%
|
backend=Agg
|
||||||
tests = True~%"
|
|
||||||
(assoc-ref inputs "tcl")
|
[directories]
|
||||||
(assoc-ref inputs "tk")))))
|
basedirlist = ~a,~a
|
||||||
#t)))))
|
|
||||||
|
[packages]
|
||||||
|
tests = True~%" (assoc-ref inputs "tcl") (assoc-ref inputs "tk"))))))
|
||||||
|
(replace 'check
|
||||||
|
(lambda* (#:key tests? #:allow-other-keys)
|
||||||
|
(when tests?
|
||||||
|
;; Step out of the source directory to avoid interference.
|
||||||
|
(with-directory-excursion "/tmp"
|
||||||
|
;; Run the installed tests, which is what we want since not
|
||||||
|
;; everything gets built in the source directory.
|
||||||
|
(invoke "pytest"
|
||||||
|
"-n" (number->string (parallel-job-count))
|
||||||
|
"-m" "not network" "--pyargs" "matplotlib"))))))))
|
||||||
(home-page "https://matplotlib.org/")
|
(home-page "https://matplotlib.org/")
|
||||||
(synopsis "2D plotting library for Python")
|
(synopsis "2D plotting library for Python")
|
||||||
(description
|
(description
|
||||||
|
|
Reference in a new issue