summary refs log tree commit diff
path: root/pkgs/development/python-modules/Theano
diff options
context:
space:
mode:
authorTyson Whitehead <twhitehead@gmail.com>2018-08-02 12:20:21 -0400
committerTyson Whitehead <twhitehead@gmail.com>2018-08-02 14:24:51 -0400
commit8413a541d524268412d2d88822c376b3b1eb6f36 (patch)
tree4d00a98fd5e83e72795a3ecd1f469735c382be27 /pkgs/development/python-modules/Theano
parent6aab63d6108b382e15bd378b922484d606319a77 (diff)
downloadnixpkgs-8413a541d524268412d2d88822c376b3b1eb6f36.tar
nixpkgs-8413a541d524268412d2d88822c376b3b1eb6f36.tar.gz
nixpkgs-8413a541d524268412d2d88822c376b3b1eb6f36.tar.bz2
nixpkgs-8413a541d524268412d2d88822c376b3b1eb6f36.tar.lz
nixpkgs-8413a541d524268412d2d88822c376b3b1eb6f36.tar.xz
nixpkgs-8413a541d524268412d2d88822c376b3b1eb6f36.tar.zst
nixpkgs-8413a541d524268412d2d88822c376b3b1eb6f36.zip
Theano: cleaner setting of g++, cuda, and dnn paths
Original was a mix of config changes and code changes with a search
and replace that also changed unintended bits such as messages.
Diffstat (limited to 'pkgs/development/python-modules/Theano')
-rw-r--r--pkgs/development/python-modules/Theano/default.nix15
1 files changed, 9 insertions, 6 deletions
diff --git a/pkgs/development/python-modules/Theano/default.nix b/pkgs/development/python-modules/Theano/default.nix
index 2c7345716f6..4341302f33a 100644
--- a/pkgs/development/python-modules/Theano/default.nix
+++ b/pkgs/development/python-modules/Theano/default.nix
@@ -50,12 +50,15 @@ in buildPythonPackage rec {
   };
 
   postPatch = ''
-    sed -i 's,g++,${gcc_}/bin/g++,g' theano/configdefaults.py
-  '' + lib.optionalString cudnnSupport ''
-    sed -i \
-      -e "s,ctypes.util.find_library('cudnn'),'${cudnn}/lib/libcudnn.so',g" \
-      -e "s/= _dnn_check_compile()/= (True, None)/g" \
-      theano/gpuarray/dnn.py
+    substituteInPlace theano/configdefaults.py \
+      --replace 'StrParam(param, is_valid=warn_cxx)' 'StrParam('\'''${gcc_}/bin/g++'\''', is_valid=warn_cxx)' \
+      --replace 'rc == 0 and config.cxx != ""' 'config.cxx != ""'
+  '' + stdenv.lib.optionalString cudaSupport ''
+    substituteInPlace theano/configdefaults.py \
+      --replace 'StrParam(get_cuda_root)' 'StrParam('\'''${cudatoolkit}'\''')'
+  '' + stdenv.lib.optionalString cudnnSupport ''
+    substituteInPlace theano/configdefaults.py \
+      --replace 'StrParam(default_dnn_base_path)' 'StrParam('\'''${cudnn}'\''')'
   '';
 
   preCheck = ''