From f933b48a53bf0284e1901a45325a3ae98050c1d7 Mon Sep 17 00:00:00 2001 From: Asko Soukka Date: Sun, 28 Jun 2015 21:25:19 +0300 Subject: [PATCH 1/2] darwin: matplotlib: add needed inputs and set framework flag for darwin --- .../python-modules/matplotlib/darwin-stdenv.patch | 11 +++++++++++ .../development/python-modules/matplotlib/default.nix | 11 +++++++++-- pkgs/top-level/python-packages.nix | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/python-modules/matplotlib/darwin-stdenv.patch diff --git a/pkgs/development/python-modules/matplotlib/darwin-stdenv.patch b/pkgs/development/python-modules/matplotlib/darwin-stdenv.patch new file mode 100644 index 000000000000..6e780dfb5a0c --- /dev/null +++ b/pkgs/development/python-modules/matplotlib/darwin-stdenv.patch @@ -0,0 +1,11 @@ +--- a/src/_macosx.m 2015-06-30 12:18:48.000000000 +0300 ++++ b/src/_macosx.m 2015-06-30 12:19:12.000000000 +0300 +@@ -5,6 +5,8 @@ + #include "numpy/arrayobject.h" + #include "path_cleanup.h" + ++#define WITH_NEXT_FRAMEWORK 1 ++ + #if PY_MAJOR_VERSION >= 3 + #define PY3K 1 + #else diff --git a/pkgs/development/python-modules/matplotlib/default.nix b/pkgs/development/python-modules/matplotlib/default.nix index b6789a851cb5..995b1459f045 100644 --- a/pkgs/development/python-modules/matplotlib/default.nix +++ b/pkgs/development/python-modules/matplotlib/default.nix @@ -4,6 +4,7 @@ , enableGhostscript ? false, ghostscript ? null, gtk3 , enableGtk2 ? false, pygtk ? null, gobjectIntrospection , enableGtk3 ? false, cairo +, Cocoa, Foundation, CoreData, cf-private, libobjc, libcxx }: assert enableGhostscript -> ghostscript != null; @@ -17,11 +18,15 @@ buildPythonPackage rec { url = "https://pypi.python.org/packages/source/m/matplotlib/${name}.tar.gz"; sha256 = "67b08b1650a00a6317d94b76a30a47320087e5244920604c5462188cba0c2646"; }; - + + 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 enableGhostscript ghostscript + ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa Foundation CoreData + cf-private libobjc ]; propagatedBuildInputs = [ cycler dateutil nose numpy pyparsing tornado freetype @@ -30,6 +35,8 @@ buildPythonPackage rec { ++ stdenv.lib.optional enableGtk2 pygtk ++ stdenv.lib.optionals enableGtk3 [ cairo pycairo gtk3 gobjectIntrospection pygobject3 ]; + patches = stdenv.lib.optionals stdenv.isDarwin [ ./darwin-stdenv.patch ]; + patchPhase = '' # Failing test: ERROR: matplotlib.tests.test_style.test_use_url sed -i 's/test_use_url/fails/' lib/matplotlib/tests/test_style.py diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 292b758b5c0b..7b6ab6a103b2 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8621,6 +8621,8 @@ let matplotlib = callPackage ../development/python-modules/matplotlib/default.nix { stdenv = if stdenv.isDarwin then pkgs.clangStdenv else pkgs.stdenv; enableGhostscript = true; + inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa Foundation CoreData; + inherit (pkgs.darwin) cf-private libobjc; }; From 80fd9e96bea93dff46aa51abe8fe40f4a3e70408 Mon Sep 17 00:00:00 2001 From: Asko Soukka Date: Sun, 1 Nov 2015 14:55:06 +0200 Subject: [PATCH 2/2] darwin: matplotlib: update darwin patch for 1.5.0 --- .../matplotlib/darwin-stdenv.patch | 19 +++++++++---------- .../python-modules/matplotlib/default.nix | 3 +-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/matplotlib/darwin-stdenv.patch b/pkgs/development/python-modules/matplotlib/darwin-stdenv.patch index 6e780dfb5a0c..ca399b4e6841 100644 --- a/pkgs/development/python-modules/matplotlib/darwin-stdenv.patch +++ b/pkgs/development/python-modules/matplotlib/darwin-stdenv.patch @@ -1,11 +1,10 @@ ---- a/src/_macosx.m 2015-06-30 12:18:48.000000000 +0300 -+++ b/src/_macosx.m 2015-06-30 12:19:12.000000000 +0300 -@@ -5,6 +5,8 @@ - #include "numpy/arrayobject.h" - #include "path_cleanup.h" +--- 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 @@ -+#define WITH_NEXT_FRAMEWORK 1 -+ - #if PY_MAJOR_VERSION >= 3 - #define PY3K 1 - #else + static bool verify_framework(void) + { ++ return true; /* nixpkgs darwin stdenv */ + #ifdef COMPILING_FOR_10_6 + NSRunningApplication* app = [NSRunningApplication currentApplication]; + NSApplicationActivationPolicy activationPolicy = [app activationPolicy]; diff --git a/pkgs/development/python-modules/matplotlib/default.nix b/pkgs/development/python-modules/matplotlib/default.nix index 995b1459f045..6eadbcb5b650 100644 --- a/pkgs/development/python-modules/matplotlib/default.nix +++ b/pkgs/development/python-modules/matplotlib/default.nix @@ -37,14 +37,13 @@ buildPythonPackage rec { patches = stdenv.lib.optionals stdenv.isDarwin [ ./darwin-stdenv.patch ]; - patchPhase = '' + 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 sed -i 's/TestTinyPages/fails/' lib/matplotlib/sphinxext/tests/test_tinypages.py ''; - meta = with stdenv.lib; { description = "python plotting library, making publication quality plots"; homepage = "http://matplotlib.sourceforge.net/";