Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 17.09 99 lines 2.6 kB view raw
1{ buildPythonPackage 2, fetchPypi 3, python 4, stdenv 5, fetchurl 6, pytest 7, glibcLocales 8, cython 9, dateutil 10, scipy 11, numexpr 12, pytz 13, xlrd 14, bottleneck 15, sqlalchemy 16, lxml 17, html5lib 18, beautifulsoup4 19, openpyxl 20, tables 21, xlwt 22, libcxx ? null 23}: 24 25let 26 inherit (stdenv.lib) optional optionalString concatStringsSep; 27 inherit (stdenv) isDarwin; 28in buildPythonPackage rec { 29 pname = "pandas"; 30 version = "0.20.3"; 31 name = "${pname}-${version}"; 32 33 src = fetchPypi { 34 inherit pname version; 35 sha256 = "a777e07633d83d546c55706420179551c8e01075b53c497dcf8ae4036766bc66"; 36 }; 37 38 LC_ALL = "en_US.UTF-8"; 39 buildInputs = [ pytest glibcLocales ] ++ optional isDarwin libcxx; 40 propagatedBuildInputs = [ 41 cython 42 dateutil 43 scipy 44 numexpr 45 pytz 46 xlrd 47 bottleneck 48 sqlalchemy 49 lxml 50 html5lib 51 beautifulsoup4 52 openpyxl 53 tables 54 xlwt 55 ]; 56 57 # For OSX, we need to add a dependency on libcxx, which provides 58 # `complex.h` and other libraries that pandas depends on to build. 59 postPatch = optionalString isDarwin '' 60 cpp_sdk="${libcxx}/include/c++/v1"; 61 echo "Adding $cpp_sdk to the setup.py common_include variable" 62 substituteInPlace setup.py \ 63 --replace "['pandas/src/klib', 'pandas/src']" \ 64 "['pandas/src/klib', 'pandas/src', '$cpp_sdk']" 65 ''; 66 67 checkPhase = '' 68 runHook preCheck 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 # since dateutil 0.6.0 the following fails: test_fallback_plural, test_ambiguous_flags, test_ambiguous_compat 80 # was supposed to be solved by https://github.com/dateutil/dateutil/issues/321, but is not the case 81 py.test $out/${python.sitePackages}/pandas --skip-slow --skip-network \ 82 -k "not test_fallback_plural and \ 83 not test_ambiguous_flags and \ 84 not test_ambiguous_compat \ 85 ${optionalString isDarwin "and not test_locale and not test_clipboard"}" 86 runHook postCheck 87 ''; 88 89 meta = { 90 # https://github.com/pandas-dev/pandas/issues/14866 91 # pandas devs are no longer testing i686 so safer to assume it's broken 92 broken = stdenv.isi686; 93 homepage = http://pandas.pydata.org/; 94 description = "Python Data Analysis Library"; 95 license = stdenv.lib.licenses.bsd3; 96 maintainers = with stdenv.lib.maintainers; [ raskin fridh knedlsepp ]; 97 platforms = stdenv.lib.platforms.unix; 98 }; 99}