matplotlib: 2.2.3 -> 3.0.2

Python 3 will use the new matplotlib 3.x while Python 2
will use 2.x.

matplotlib: keep 2.2.3 for Python2k
This commit is contained in:
Sebastien Maret 2018-11-03 13:40:48 +01:00 committed by Frederik Rietdijk
parent 961180afc8
commit 880fae6a08
5 changed files with 121 additions and 16 deletions

@ -0,0 +1,91 @@
{ stdenv, fetchPypi, python, buildPythonPackage, pycairo, backports_functools_lru_cache
, which, cycler, dateutil, nose, numpy, pyparsing, sphinx, tornado, kiwisolver
, freetype, libpng, pkgconfig, mock, pytz, pygobject3, functools32, subprocess32
, enableGhostscript ? false, ghostscript ? null, gtk3
, enableGtk2 ? false, pygtk ? null, gobjectIntrospection
, enableGtk3 ? false, cairo
, enableTk ? false, tcl ? null, tk ? null, tkinter ? null, libX11 ? null
, enableQt ? false, pyqt4
, libcxx
, Cocoa
, pythonOlder
}:
assert enableGhostscript -> ghostscript != null;
assert enableGtk2 -> pygtk != null;
assert enableTk -> (tcl != null)
&& (tk != null)
&& (tkinter != null)
&& (libX11 != null)
;
assert enableQt -> pyqt4 != null;
buildPythonPackage rec {
version = "2.2.3";
pname = "matplotlib";
src = fetchPypi {
inherit pname version;
sha256 = "7355bf757ecacd5f0ac9dd9523c8e1a1103faadf8d33c22664178e17533f8ce5";
};
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
XDG_RUNTIME_DIR = "/tmp";
buildInputs = [ python which sphinx stdenv ]
++ stdenv.lib.optional enableGhostscript ghostscript
++ stdenv.lib.optional stdenv.isDarwin [ Cocoa ];
propagatedBuildInputs =
[ cycler dateutil nose numpy pyparsing tornado freetype kiwisolver
libpng pkgconfig mock pytz ]
++ stdenv.lib.optional (pythonOlder "3.3") backports_functools_lru_cache
++ stdenv.lib.optional enableGtk2 pygtk
++ stdenv.lib.optionals enableGtk3 [ cairo pycairo gtk3 gobjectIntrospection pygobject3 ]
++ stdenv.lib.optionals enableTk [ tcl tk tkinter libX11 ]
++ stdenv.lib.optionals enableQt [ pyqt4 ]
++ stdenv.lib.optionals (builtins.hasAttr "isPy2" python) [ functools32 subprocess32 ];
patches =
[ ./basedirlist.patch ] ++
stdenv.lib.optionals stdenv.isDarwin [ ./darwin-stdenv-2.2.3.patch ];
# Matplotlib tries to find Tcl/Tk by opening a Tk window and asking the
# corresponding interpreter object for its library paths. This fails if
# `$DISPLAY` is not set. The fallback option assumes that Tcl/Tk are both
# installed under the same path which is not true in Nix.
# With the following patch we just hard-code these paths into the install
# script.
postPatch =
let
inherit (stdenv.lib.strings) substring;
tcl_tk_cache = ''"${tk}/lib", "${tcl}/lib", "${substring 0 3 tk.version}"'';
in
stdenv.lib.optionalString enableTk
"sed -i '/self.tcl_tk_cache = None/s|None|${tcl_tk_cache}|' setupext.py";
checkPhase = ''
${python.interpreter} tests.py
'';
# Test data is not included in the distribution (the `tests` folder
# is missing)
doCheck = false;
prePatch = ''
# Failing test: ERROR: matplotlib.tests.test_style.test_use_url
sed -i 's/test_use_url/fails/' lib/matplotlib/tests/test_style.py
# Failing test: ERROR: test suite for <class 'matplotlib.sphinxext.tests.test_tinypages.TestTinyPages'>
sed -i 's/TestTinyPages/fails/' lib/matplotlib/sphinxext/tests/test_tinypages.py
# Transient errors
sed -i 's/test_invisible_Line_rendering/noop/' lib/matplotlib/tests/test_lines.py
'';
meta = with stdenv.lib; {
description = "Python plotting library, making publication quality plots";
homepage = "https://matplotlib.org/";
maintainers = with maintainers; [ lovek323 ];
};
}

@ -0,0 +1,10 @@
--- a/src/_macosx.m 2015-10-30 00:46:20.000000000 +0200
+++ b/src/_macosx.m 2015-11-01 14:52:25.000000000 +0200
@@ -6264,6 +6264,7 @@
static bool verify_framework(void)
{
+ return true; /* nixpkgs darwin stdenv */
#ifdef COMPILING_FOR_10_6
NSRunningApplication* app = [NSRunningApplication currentApplication];
NSApplicationActivationPolicy activationPolicy = [app activationPolicy];

@ -1,10 +1,12 @@
--- a/src/_macosx.m 2015-10-30 00:46:20.000000000 +0200
+++ b/src/_macosx.m 2015-11-01 14:52:25.000000000 +0200
@@ -6264,6 +6264,7 @@
diff -ruN matplotlib-3.0.0/src/_macosx.m matplotlib-3.0.0.patched/src/_macosx.m
--- matplotlib-3.0.0/src/_macosx.m 2018-09-16 00:35:21.000000000 +0200
+++ matplotlib-3.0.0.patched/src/_macosx.m 2018-11-03 13:14:33.000000000 +0100
@@ -2577,6 +2577,7 @@
static bool verify_framework(void)
{
+ return true; /* nixpkgs darwin stdenv */
#ifdef COMPILING_FOR_10_6
NSRunningApplication* app = [NSRunningApplication currentApplication];
NSApplicationActivationPolicy activationPolicy = [app activationPolicy];
ProcessSerialNumber psn;
/* These methods are deprecated, but they don't require the app to
have started */

@ -1,7 +1,7 @@
{ stdenv, fetchPypi, python, buildPythonPackage, pycairo, backports_functools_lru_cache
{ stdenv, fetchPypi, python, buildPythonPackage, isPy3k, pycairo, backports_functools_lru_cache
, which, cycler, dateutil, nose, numpy, pyparsing, sphinx, tornado, kiwisolver
, freetype, libpng, pkgconfig, mock, pytz, pygobject3, functools32, subprocess32
, enableGhostscript ? false, ghostscript ? null, gtk3
, enableGhostscript ? true, ghostscript ? null, gtk3
, enableGtk2 ? false, pygtk ? null, gobjectIntrospection
, enableGtk3 ? false, cairo
, enableTk ? false, tcl ? null, tk ? null, tkinter ? null, libX11 ? null
@ -21,12 +21,14 @@ assert enableTk -> (tcl != null)
assert enableQt -> pyqt4 != null;
buildPythonPackage rec {
version = "2.2.3";
version = "3.0.2";
pname = "matplotlib";
disabled = !isPy3k;
src = fetchPypi {
inherit pname version;
sha256 = "7355bf757ecacd5f0ac9dd9523c8e1a1103faadf8d33c22664178e17533f8ce5";
sha256 = "c94b792af431f6adb6859eb218137acd9a35f4f7442cea57e4a59c54751c36af";
};
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
@ -44,8 +46,7 @@ buildPythonPackage rec {
++ stdenv.lib.optional enableGtk2 pygtk
++ stdenv.lib.optionals enableGtk3 [ cairo pycairo gtk3 gobjectIntrospection pygobject3 ]
++ stdenv.lib.optionals enableTk [ tcl tk tkinter libX11 ]
++ stdenv.lib.optionals enableQt [ pyqt4 ]
++ stdenv.lib.optionals (builtins.hasAttr "isPy2" python) [ functools32 subprocess32 ];
++ stdenv.lib.optionals enableQt [ pyqt4 ];
patches =
[ ./basedirlist.patch ] ++
@ -84,9 +85,8 @@ buildPythonPackage rec {
meta = with stdenv.lib; {
description = "Python plotting library, making publication quality plots";
homepage = "http://matplotlib.sourceforge.net/";
homepage = "https://matplotlib.org/";
maintainers = with maintainers; [ lovek323 ];
platforms = platforms.unix;
};
}

@ -2746,9 +2746,11 @@ in {
mathics = callPackage ../development/python-modules/mathics { };
matplotlib = callPackage ../development/python-modules/matplotlib {
matplotlib = let
path = if isPy3k then ../development/python-modules/matplotlib/default.nix else
../development/python-modules/matplotlib/2.nix;
in callPackage path {
stdenv = if stdenv.isDarwin then pkgs.clangStdenv else pkgs.stdenv;
enableGhostscript = true;
inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa;
};