mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 17:25:11 +00:00
92a77abd31
* xgboost: Enable building on Darwin * Review feedback: pass `xgboost` to the python package
36 lines
744 B
Nix
36 lines
744 B
Nix
{ stdenv
|
|
, lib
|
|
, pkgs
|
|
, buildPythonPackage
|
|
, nose
|
|
, scipy
|
|
, xgboost
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
name = "xgboost-${version}";
|
|
|
|
inherit (xgboost) version src meta;
|
|
|
|
propagatedBuildInputs = [ scipy ];
|
|
checkInputs = [ nose ];
|
|
|
|
postPatch = let
|
|
libname = if stdenv.isDarwin then "libxgboost.dylib" else "libxgboost.so";
|
|
|
|
in ''
|
|
cd python-package
|
|
|
|
sed "s/CURRENT_DIR = os.path.dirname(__file__)/CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))/g" -i setup.py
|
|
sed "/^LIB_PATH.*/a LIB_PATH = [os.path.relpath(LIB_PATH[0], CURRENT_DIR)]" -i setup.py
|
|
cat <<EOF >xgboost/libpath.py
|
|
def find_lib_path():
|
|
return ["${xgboost}/lib/${libname}"]
|
|
EOF
|
|
'';
|
|
|
|
postInstall = ''
|
|
rm -rf $out/xgboost
|
|
'';
|
|
}
|