diff options
author | Yifei Feng <yifeif@google.com> | 2018-02-22 14:24:57 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-02-22 14:29:27 -0800 |
commit | dce9a49c19f406ba45919e8c94474e55dc5ccd54 (patch) | |
tree | 928db8a52603e00aef76985cda16b8bceb9debb2 /third_party/gpus | |
parent | cb7e1963c625fd9713e7475d85621f95be6762f1 (diff) |
Merge changes from github.
PiperOrigin-RevId: 186674197
Diffstat (limited to 'third_party/gpus')
-rw-r--r-- | third_party/gpus/cuda_configure.bzl | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/third_party/gpus/cuda_configure.bzl b/third_party/gpus/cuda_configure.bzl index 255ae01190..b7c47a19dd 100644 --- a/third_party/gpus/cuda_configure.bzl +++ b/third_party/gpus/cuda_configure.bzl @@ -367,11 +367,20 @@ def find_cuda_define(repository_ctx, header_dir, header_file, define): if result.stdout.find(define) == -1: auto_configure_fail("Cannot find line containing '%s' in %s" % (define, h_path)) - version = result.stdout - # Remove the new line and '\' character if any. - version = version.replace("\\", " ") - version = version.replace("\n", " ") - version = version.replace(define, "").lstrip() + # Split results to lines + lines = result.stdout.split('\n') + num_lines = len(lines) + for l in range(num_lines): + line = lines[l] + if define in line: # Find the line with define + version = line + if l != num_lines-1 and line[-1] == '\\': # Add next line, if multiline + version = version[:-1] + lines[l+1] + break + # Remove any comments + version = version.split("//")[0] + # Remove define name + version = version.replace(define, "").strip() # Remove the code after the version number. version_end = version.find(" ") if version_end != -1: |