diff options
author | Andrew Dunham <andrew@du.nham.ca> | 2018-03-14 18:17:55 -0700 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2018-03-15 04:17:55 +0300 |
commit | 92a77abd31e6c252390b1baa8a25553909e3f344 (patch) | |
tree | 04490a34ccf4525cebb7adc66aff8f196e6edb9f /pkgs/development/python-modules/xgboost | |
parent | 80582c600dadd6bd2a15f64a4e3e7da074adc71d (diff) | |
download | nixpkgs-92a77abd31e6c252390b1baa8a25553909e3f344.tar nixpkgs-92a77abd31e6c252390b1baa8a25553909e3f344.tar.gz nixpkgs-92a77abd31e6c252390b1baa8a25553909e3f344.tar.bz2 nixpkgs-92a77abd31e6c252390b1baa8a25553909e3f344.tar.lz nixpkgs-92a77abd31e6c252390b1baa8a25553909e3f344.tar.xz nixpkgs-92a77abd31e6c252390b1baa8a25553909e3f344.tar.zst nixpkgs-92a77abd31e6c252390b1baa8a25553909e3f344.zip |
xgboost: Enable building on Darwin (#37046)
* xgboost: Enable building on Darwin * Review feedback: pass `xgboost` to the python package
Diffstat (limited to 'pkgs/development/python-modules/xgboost')
-rw-r--r-- | pkgs/development/python-modules/xgboost/default.nix | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/xgboost/default.nix b/pkgs/development/python-modules/xgboost/default.nix new file mode 100644 index 00000000000..217c823afe5 --- /dev/null +++ b/pkgs/development/python-modules/xgboost/default.nix @@ -0,0 +1,35 @@ +{ 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 + ''; +} |