nixpkgs/pkgs/development/python-modules/pyarrow/default.nix
Dmitry Kalinkin e5690827b5
python3Packages.pyarrow: fix darwin build for when a build flag is false
nix-repl> with import <nixpkgs> {}; stdenv.mkDerivation { name="test"; true = true; false = false; }
«derivation /nix/store/2xk4hhfnaqymwq0iw9hxi5a34a8dbywz-test.drv»

nix show-derivation /nix/store/2xk4hhfnaqymwq0iw9hxi5a34a8dbywz-test.drv | grep -E '(true|false)'
      "false": "",
      "true": "1"

  File "setup.py", line 77, in strtobool
    raise ValueError("invalid truth value %r" % (val,))
ValueError: invalid truth value ''
2021-12-02 05:32:11 -05:00

77 lines
2.4 KiB
Nix

{ lib, stdenv, buildPythonPackage, python, isPy3k, arrow-cpp, cmake, cython, hypothesis, numpy, pandas, pytestCheckHook, pytest-lazy-fixture, pkg-config, setuptools-scm, six }:
let
zero_or_one = cond: if cond then 1 else 0;
_arrow-cpp = arrow-cpp.override { python3 = python; };
in
buildPythonPackage rec {
pname = "pyarrow";
disabled = !isPy3k;
inherit (_arrow-cpp) version src;
sourceRoot = "apache-arrow-${version}/python";
nativeBuildInputs = [ cmake cython pkg-config setuptools-scm ];
propagatedBuildInputs = [ numpy six ];
checkInputs = [ hypothesis pandas pytestCheckHook pytest-lazy-fixture ];
PYARROW_BUILD_TYPE = "release";
PYARROW_WITH_DATASET = zero_or_one true;
PYARROW_WITH_FLIGHT = zero_or_one _arrow-cpp.enableFlight;
PYARROW_WITH_PARQUET = zero_or_one true;
PYARROW_CMAKE_OPTIONS = [
"-DCMAKE_INSTALL_RPATH=${ARROW_HOME}/lib"
# This doesn't use setup hook to call cmake so we need to workaround #54606
# ourselves
"-DCMAKE_POLICY_DEFAULT_CMP0025=NEW"
];
ARROW_HOME = _arrow-cpp;
PARQUET_HOME = _arrow-cpp;
ARROW_TEST_DATA = lib.optionalString doCheck _arrow-cpp.ARROW_TEST_DATA;
doCheck = true;
dontUseCmakeConfigure = true;
preBuild = ''
export PYARROW_PARALLEL=$NIX_BUILD_CORES
'';
pytestFlagsArray = [
# Deselect a single test because pyarrow prints a 2-line error message where
# only a single line is expected. The additional line of output comes from
# the glog library which is an optional dependency of arrow-cpp that is
# enabled in nixpkgs.
# Upstream Issue: https://issues.apache.org/jira/browse/ARROW-11393
"--deselect=pyarrow/tests/test_memory.py::test_env_var"
# Deselect a parquet dataset test because it erroneously fails to find the
# pyarrow._dataset module.
"--deselect=pyarrow/tests/parquet/test_dataset.py::test_parquet_dataset_deprecated_properties"
] ++ lib.optionals stdenv.isDarwin [
# Requires loopback networking
"--deselect=pyarrow/tests/test_ipc.py::test_socket_"
];
dontUseSetuptoolsCheck = true;
preCheck = ''
mv pyarrow/tests tests
rm -rf pyarrow
mkdir pyarrow
mv tests pyarrow/tests
'';
meta = with lib; {
description = "A cross-language development platform for in-memory data";
homepage = "https://arrow.apache.org/";
license = licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ veprbl cpcloud ];
};
}