From 8413a541d524268412d2d88822c376b3b1eb6f36 Mon Sep 17 00:00:00 2001 From: Tyson Whitehead Date: Thu, 2 Aug 2018 12:20:21 -0400 Subject: [PATCH] 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. --- .../development/python-modules/Theano/default.nix | 15 +++++++++------ 1 file 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 = ''