about summary refs log tree commit diff
path: root/pkgs/development/python-modules/termplotlib
diff options
context:
space:
mode:
authorRasmus Précenth <rasmus@precenth.eu>2021-11-19 21:33:47 +0100
committertomberek <tomberek@users.noreply.github.com>2021-11-20 19:13:26 -0500
commit8afc4e543663ca0a6a4f496262cd05233737e732 (patch)
treeacabe04e38aeccb7f14ba83e4539abfe507f8b60 /pkgs/development/python-modules/termplotlib
parent42133e84517a8aef0de2788160055494284a0447 (diff)
pythonPackages.termplotlib: fix build
1. New tests are failing with gnuplot 5.4.2
2. Propagate gnuplot and numpy
Diffstat (limited to 'pkgs/development/python-modules/termplotlib')
-rw-r--r--pkgs/development/python-modules/termplotlib/default.nix26
-rw-r--r--pkgs/development/python-modules/termplotlib/gnuplot-subprocess.patch26
2 files changed, 47 insertions, 5 deletions
diff --git a/pkgs/development/python-modules/termplotlib/default.nix b/pkgs/development/python-modules/termplotlib/default.nix
index 06432b673afd4..fde1080491e01 100644
--- a/pkgs/development/python-modules/termplotlib/default.nix
+++ b/pkgs/development/python-modules/termplotlib/default.nix
@@ -1,4 +1,5 @@
 { lib
+, substituteAll
 , buildPythonPackage
 , fetchFromGitHub
 , pytestCheckHook
@@ -19,13 +20,28 @@ buildPythonPackage rec {
   };
 
   format = "pyproject";
-  checkInputs = [ pytestCheckHook numpy exdown gnuplot ];
+  checkInputs = [
+    pytestCheckHook
+    exdown
+  ];
   pythonImportsCheck = [ "termplotlib" ];
 
-  # there seems to be a newline in the very front of the output
-  # which causes the test to fail, since it apparently doesn't
-  # strip whitespace. might be a gnuplot choice? sigh...
-  disabledTests = [ "test_plot_lim" ];
+  propagatedBuildInputs = [ numpy ];
+
+  patches = [
+    (substituteAll {
+      src = ./gnuplot-subprocess.patch;
+      gnuplot = "${gnuplot.out}/bin/gnuplot";
+    })
+  ];
+
+  # The current gnuplot version renders slightly different test
+  # graphs, with emphasis on slightly. The plots are still correct.
+  # Tests pass on gnuplot 5.4.1, but fail on 5.4.2.
+  disabledTests = [
+    "test_plot"
+    "test_nolabel"
+  ];
 
   meta = with lib; {
     description = "matplotlib for your terminal";
diff --git a/pkgs/development/python-modules/termplotlib/gnuplot-subprocess.patch b/pkgs/development/python-modules/termplotlib/gnuplot-subprocess.patch
new file mode 100644
index 0000000000000..5935dbda12652
--- /dev/null
+++ b/pkgs/development/python-modules/termplotlib/gnuplot-subprocess.patch
@@ -0,0 +1,26 @@
+diff --git a/src/termplotlib/helpers.py b/src/termplotlib/helpers.py
+index 4b67fd0..38a2242 100644
+--- a/src/termplotlib/helpers.py
++++ b/src/termplotlib/helpers.py
+@@ -32,7 +32,7 @@ def is_unicode_standard_output():
+ 
+ 
+ def get_gnuplot_version():
+-    out = subprocess.check_output(["gnuplot", "--version"]).decode()
++    out = subprocess.check_output(["@gnuplot@", "--version"]).decode()
+     m = re.match("gnuplot (\\d).(\\d) patchlevel (\\d)\n", out)
+     if m is None:
+         raise RuntimeError("Couldn't get gnuplot version")
+diff --git a/src/termplotlib/plot.py b/src/termplotlib/plot.py
+index 0f46b87..1418fd1 100644
+--- a/src/termplotlib/plot.py
++++ b/src/termplotlib/plot.py
+@@ -17,7 +17,7 @@ def plot(
+     ticks_scale: int = 0,
+ ):
+     p = subprocess.Popen(
+-        ["gnuplot"],
++        ["@gnuplot@"],
+         stdout=subprocess.PIPE,
+         stdin=subprocess.PIPE,
+         stderr=subprocess.PIPE,