diff --git a/pkgs/development/python-modules/matplotlib/default.nix b/pkgs/development/python-modules/matplotlib/default.nix index 7364920cba22c..12ef896117abb 100644 --- a/pkgs/development/python-modules/matplotlib/default.nix +++ b/pkgs/development/python-modules/matplotlib/default.nix @@ -1,16 +1,21 @@ -{ lib, stdenv, fetchPypi, writeText, python, buildPythonPackage, isPy3k, pycairo, backports_functools_lru_cache -, which, cycler, dateutil, nose, numpy, pyparsing, sphinx, tornado, kiwisolver +{ lib, stdenv, fetchPypi, writeText, buildPythonPackage, isPy3k, pycairo +, which, cycler, dateutil, numpy, pyparsing, sphinx, tornado, kiwisolver , freetype, qhull, libpng, pkg-config, mock, pytz, pygobject3, gobject-introspection , certifi, pillow , enableGhostscript ? true, ghostscript, gtk3 , enableGtk3 ? false, cairo # darwin has its own "MacOSX" backend -, enableTk ? !stdenv.isDarwin, tcl, tk, tkinter, libX11 +, enableTk ? !stdenv.isDarwin, tcl, tk, tkinter , enableQt ? false, pyqt5 +# required for headless detection +, libX11, wayland , Cocoa -, pythonOlder }: +let + interactive = enableTk || enableGtk3 || enableQt; +in + buildPythonPackage rec { version = "3.4.1"; pname = "matplotlib"; @@ -62,8 +67,14 @@ buildPythonPackage rec { let tcl_tk_cache = ''"${tk}/lib", "${tcl}/lib", "${lib.strings.substring 0 3 tk.version}"''; in - lib.optionalString enableTk - "sed -i '/self.tcl_tk_cache = None/s|None|${tcl_tk_cache}|' setupext.py"; + lib.optionalString enableTk '' + sed -i '/self.tcl_tk_cache = None/s|None|${tcl_tk_cache}|' setupext.py + '' + lib.optionalString (stdenv.isLinux && interactive) '' + # fix paths to libraries in dlopen calls (headless detection) + substituteInPlace src/_c_internal_utils.c \ + --replace libX11.so.6 ${libX11}/lib/libX11.so.6 \ + --replace libwayland-client.so.0 ${wayland}/lib/libwayland-client.so.0 + ''; # Matplotlib needs to be built against a specific version of freetype in # order for all of the tests to pass. @@ -72,6 +83,7 @@ buildPythonPackage rec { meta = with lib; { description = "Python plotting library, making publication quality plots"; homepage = "https://matplotlib.org/"; + license = with licenses; [ psfl bsd0 ]; maintainers = with maintainers; [ lovek323 veprbl ]; };