diff options
Diffstat (limited to 'pkgs/development/python-modules/xgboost/default.nix')
-rw-r--r-- | pkgs/development/python-modules/xgboost/default.nix | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/pkgs/development/python-modules/xgboost/default.nix b/pkgs/development/python-modules/xgboost/default.nix index 9b53c180397df..d9b8fc892c165 100644 --- a/pkgs/development/python-modules/xgboost/default.nix +++ b/pkgs/development/python-modules/xgboost/default.nix @@ -3,30 +3,28 @@ , nose , scipy , xgboost +, substituteAll }: buildPythonPackage rec { pname = "xgboost"; inherit (xgboost) version src meta; - propagatedBuildInputs = [ scipy ]; - checkInputs = [ nose ]; - - postPatch = let - libname = "libxgboost.${stdenv.hostPlatform.extensions.sharedLibrary}"; + patches = [ + (substituteAll { + src = ./lib-path-for-python.patch; + libpath = "${xgboost}/lib"; + }) + ]; - in '' - cd python-package + postPatch = "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 - ''; + propagatedBuildInputs = [ scipy ]; + buildInputs = [ xgboost ]; + checkInputs = [ nose ]; - postInstall = '' - rm -rf $out/xgboost + checkPhase = '' + ln -sf ../demo . + nosetests ../tests/python ''; } |