git.iko.soy/typeable/nixpkgs
on master help sign in
pandas: Fix build on darwin

Since the commands "locale", "pbpaste" and "pbcopy" are not in nixpkgs, as they are impure darwin dependencies, we currently cannot get the clipboard and locale functionality to work properly. We disable the tests "test_locale" and "test_clipboard" on darwin, so we get a mostly working pandas. Additionally to disabling the test via py.test, we also need to provide fake pbpaste/pbcopy commands, so py.test won't fail during the collection phase. This closes #25417 and closes #11623.

commiteb2994a0d5541d591cd4fc2435b978b00b19bc46 authorJosef Kemetmueller <josef.kemetmueller@gmail.com> dateTue 30 May 2017, 02:14 (9 years ago) parent1d56c2f
1 file changed+14−9
pkgs/development/python-modules/pandas/default.nix+14−9
pkgs/development/python-modules/pandas/default.nix+14−9
@@ -19,7 +19,6 @@
1919, openpyxl
2020, tables
2121, xlwt
22−, darwin ? {}
2322, libcxx ? null
2423}:
2524
@@ -53,7 +52,7 @@ in buildPythonPackage rec {
5352 openpyxl
5453 tables
5554 xlwt
56− ] ++ optional isDarwin darwin.locale; # provides the locale command
55+ ];
5756
5857 # For OSX, we need to add a dependency on libcxx, which provides
5958 # `complex.h` and other libraries that pandas depends on to build.
@@ -63,16 +62,22 @@ in buildPythonPackage rec {
6362 substituteInPlace setup.py \
6463 --replace "['pandas/src/klib', 'pandas/src']" \
6564 "['pandas/src/klib', 'pandas/src', '$cpp_sdk']"
66−
67− # disable clipboard tests since pbcopy/pbpaste are not open source
68− substituteInPlace pandas/io/tests/test_clipboard.py \
69− --replace pandas.util.clipboard no_such_module \
70− --replace OSError ImportError
7165 '';
7266
7367 checkPhase = ''
7468 runHook preCheck
75− py.test $out/${python.sitePackages}/pandas --skip-slow --skip-network
69+ ''
70+ # TODO: Get locale and clipboard support working on darwin.
71+ # Until then we disable the tests.
72+ + optionalString isDarwin ''
73+ # Fake the impure dependencies pbpaste and pbcopy
74+ echo "#!/bin/sh" > pbcopy
75+ echo "#!/bin/sh" > pbpaste
76+ chmod a+x pbcopy pbpaste
77+ export PATH=$(pwd):$PATH
78+ '' + ''
79+ py.test $out/${python.sitePackages}/pandas --skip-slow --skip-network \
80+ ${if isDarwin then "-k 'not test_locale and not test_clipboard'" else ""}
7681 runHook postCheck
7782 '';
7883
@@ -83,7 +88,7 @@ in buildPythonPackage rec {
8388 homepage = "http://pandas.pydata.org/";
8489 description = "Python Data Analysis Library";
8590 license = stdenv.lib.licenses.bsd3;
86− maintainers = with stdenv.lib.maintainers; [ raskin fridh ];
91+ maintainers = with stdenv.lib.maintainers; [ raskin fridh knedlsepp ];
8792 platforms = stdenv.lib.platforms.unix;
8893 };
8994}