1{ stdenv, fetchurl, python, buildPythonPackage, pycairo 2, which, cycler, dateutil, nose, numpy, pyparsing, sphinx, tornado 3, freetype, libpng, pkgconfig, mock, pytz, pygobject3 4, enableGhostscript ? false, ghostscript ? null, gtk3 5, enableGtk2 ? false, pygtk ? null, gobjectIntrospection 6, enableGtk3 ? false, cairo 7, Cocoa, Foundation, CoreData, cf-private, libobjc, libcxx 8}: 9 10assert enableGhostscript -> ghostscript != null; 11assert enableGtk2 -> pygtk != null; 12 13buildPythonPackage rec { 14 name = "matplotlib-${version}"; 15 version = "1.5.1"; 16 17 src = fetchurl { 18 url = "https://pypi.python.org/packages/source/m/matplotlib/${name}.tar.gz"; 19 sha256 = "3ab8d968eac602145642d0db63dd8d67c85e9a5444ce0e2ecb2a8fedc7224d40"; 20 }; 21 22 NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1"; 23 24 XDG_RUNTIME_DIR = "/tmp"; 25 26 buildInputs = [ python which sphinx stdenv ] 27 ++ stdenv.lib.optional enableGhostscript ghostscript 28 ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa Foundation CoreData 29 cf-private libobjc ]; 30 31 propagatedBuildInputs = 32 [ cycler dateutil nose numpy pyparsing tornado freetype 33 libpng pkgconfig mock pytz 34 ] 35 ++ stdenv.lib.optional enableGtk2 pygtk 36 ++ stdenv.lib.optionals enableGtk3 [ cairo pycairo gtk3 gobjectIntrospection pygobject3 ]; 37 38 patches = stdenv.lib.optionals stdenv.isDarwin [ ./darwin-stdenv.patch ]; 39 40 checkPhase = '' 41 ${python.interpreter} tests.py 42 ''; 43 44 # The entry point for running tests, tests.py, is not included in the release. 45 # https://github.com/matplotlib/matplotlib/issues/6017 46 doCheck = false; 47 48 prePatch = '' 49 # Failing test: ERROR: matplotlib.tests.test_style.test_use_url 50 sed -i 's/test_use_url/fails/' lib/matplotlib/tests/test_style.py 51 # Failing test: ERROR: test suite for <class 'matplotlib.sphinxext.tests.test_tinypages.TestTinyPages'> 52 sed -i 's/TestTinyPages/fails/' lib/matplotlib/sphinxext/tests/test_tinypages.py 53 # Transient errors 54 sed -i 's/test_invisible_Line_rendering/noop/' lib/matplotlib/tests/test_lines.py 55 ''; 56 57 meta = with stdenv.lib; { 58 description = "python plotting library, making publication quality plots"; 59 homepage = "http://matplotlib.sourceforge.net/"; 60 maintainers = with maintainers; [ lovek323 ]; 61 platforms = platforms.unix; 62 }; 63 64}