diff mbox series

[bug#67813,10/12] gnu: python-matplotlib: Update to 3.6.3.

Message ID 20231213215635.15562-10-ngraves@ngraves.fr
State New
Headers show
Series [bug#67813,01/12] gnu: meson/newer: Update to 1.2.1. | expand

Commit Message

Nicolas Graves Dec. 13, 2023, 9:56 p.m. UTC
* gnu/packages/python-xyz.scm (python-matplotlib): Update to 3.6.3.
[build-system]: Use pyproject-build-system.
[arguments]
  (test-flags): Add proper test-flag.
  (phases): Delete phases pretend-version, fix-and-disable-failing-tests. Add
  phase mark-image-comparisons. Simplify phase configure-environment. Delete
  check replacement phase.
[propagated-inputs]: Add python-contourpy.
---
 gnu/packages/python-xyz.scm | 92 ++++++++++++-------------------------
 1 file changed, 30 insertions(+), 62 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index fd9e404f0b..8ad0ee4f9a 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -174,6 +174,7 @@  (define-module (gnu packages python-xyz)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bdw-gc)
+  #:use-module (gnu packages build-tools)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
@@ -8059,26 +8060,37 @@  (define-public python-proto-matcher
 (define-public python-matplotlib
   (package
     (name "python-matplotlib")
-    (version "3.5.2")
+    (version "3.6.3")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "matplotlib" version))
        (sha256
-        (base32 "18h78s5ld1i6mz00w258hy29909nfr3ddq6ry9kq18agw468bks8"))))
-    (build-system python-build-system)
+        (base32 "1jdq7hsmcay1z2ghdf9gjl3zys1gjvj4wm2jv465cxqngdq6jk8z"))))
+    (build-system pyproject-build-system)
     (arguments
      (list
+      #:test-flags
+      #~(list "--exitfirst"
+              "-n" (number->string (parallel-job-count))
+              "-o" "markers=image_comparison"
+              "-m" "not network and not image_comparison"
+              "--pyargs" "matplotlib"
+              "-k" (string-append
+                    "not test_failing_ffmpeg "
+                    "and not test_normal_axes "
+                    "and not test_hidden_axes "
+                    "and not test_compressed1 "
+                    "and not test_get_tightbbox_polar "
+                    "and not test_warn_big_data_best_loc "
+                    "and not test_outward_ticks "
+                    ;; The 'test_lazy_auto_backend_selection' fails
+                    ;; because it would require an X server; skip it.
+                    "and not test_lazy_auto_backend_selection "))
       #:phases
       #~(modify-phases %standard-phases
-          (add-before 'build 'pretend-version
-            ;; The version string is usually derived via setuptools-scm, but
-            ;; without the git metadata available, the version string is set to
-            ;; '0.0.0'.
-            (lambda _
-              (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)))
-          (add-after 'unpack 'fix-and-disable-failing-tests
-            ;; XXX: Disable all image comparison tests because we're using a
+          (add-after 'unpack 'mark-image-comparisons
+            ;; XXX: Mark all image comparison tests because we're using a
             ;; newer version of FreeType than matplotlib expects.  This leads
             ;; to minor differences throughout the tests.
             (lambda _
@@ -8090,37 +8102,15 @@  (define-public python-matplotlib
                  (string-append "import pytest\n" match))
                 (("( *)@([^_]+_)*(image_comparison|check_figures_equal)" match
                   indent)
-                 (string-append indent "@pytest.mark.skip(\
-reason=\"unknown minor image differences\")\n" match)))
-              (substitute* "lib/matplotlib/tests/test_animation.py"
-                (("/bin/sh") (which "sh")))
-              (for-each delete-file
-                        ;; test_normal_axes, test_get_tightbbox_polar
-                        '("lib/matplotlib/tests/test_axes.py"
-                          "lib/matplotlib/tests/test_polar.py"
-                          ;; We don't use the webagg backend and this test
-                          ;; forces it.
-                          "lib/matplotlib/tests/test_backend_webagg.py"
-                          ;; test_outward_ticks
-                          "lib/matplotlib/tests/test_tightlayout.py"
-                          ;; test_hidden_axes fails with minor extent
-                          ;; differences, possibly due to the use of a
-                          ;; different version of FreeType.
-                          "lib/matplotlib/tests/test_constrainedlayout.py"
-                          ;; Fontconfig returns no fonts.
-                          "lib/matplotlib/tests/test_font_manager.py"
-                          ;; The images comparison test fails
-                          ;; non-deterministically when run in parallel (see:
-                          ;; https://github.com/matplotlib/matplotlib/issues/22992).
-                          "lib/matplotlib/tests/test_compare_images.py"))))
+                 (string-append indent "@pytest.mark.image_comparison\n" match)))))
           (add-before 'build 'configure-environment
-            (lambda* (#:key inputs #:allow-other-keys)
+            (lambda _
               ;; Fix rounding errors when using the x87 FPU.
               (when (string-prefix? "i686" #$(%current-system))
                 (setenv "CFLAGS" "-ffloat-store"))
-              (call-with-output-file "mplsetup.cfg"
-                (lambda (port)
-                  (format port "\
+              (with-output-to-file "mplsetup.cfg"
+                (lambda -
+                  (display "\
 [libs]
 system_freetype = true
 system_qhull = true
@@ -8128,35 +8118,13 @@  (define-public python-matplotlib
 [rc_options]
 backend=Agg
 
-[directories]
-basedirlist = ~a,~a
-
 [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"
-                          "-k"
-                          (string-append
-                           ;; The 'test_lazy_auto_backend_selection' fails
-                           ;; because it would require an X server; skip it.
-                           "not test_lazy_auto_backend_selection"
-                           ;; test_getattr fails for the GTK backend because
-                           ;; of an unexpected warning from Python 3.10
-                           ;; (via the gi module):
-                           ;; https://gitlab.gnome.org/GNOME/pygobject/-/issues/494
-                           " and not test_getattr")))))))))
+tests = True"))))))))
     (propagated-inputs
      (list gobject-introspection
            python-cairocffi
            python-certifi
+           python-contourpy
            python-cycler
            python-dateutil
            python-fonttools-minimal