Description: Fix TensorRT version detection
 Extracted from upstream dce9a49c19f406ba45919e8c94474e55dc5ccd54
 .
 python-tensorflow-cuda (1.6.0-1) unstable; urgency=medium
 .
   * New upstream release.
   * New Python dependencies: astor (>= 0.6.0~), gast (>= 0.2.0~),
     grpcio (>= 1.8.6~) and termcolor (1.1.0~).
   * Remove Fix_error_no_matching_function_for_call_to_transform_build_error
     patch, merged upstream.
   * Enable Apache Kafka.
   * Enable NVIDIA TensorRT support on CUDA 8+ (add libnvinfer-dev build
     dependency).
Author: Adam Cecile <acecile@le-vert.net>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: upstream, https://github.com/tensorflow/tensorflow/commit/dce9a49c19f406ba45919e8c94474e55dc5ccd54
Forwarded: not-needed
Reviewed-By: TF upstream
Last-Update: 2018-04-18

--- python-tensorflow-cuda-1.6.0.orig/third_party/gpus/cuda_configure.bzl
+++ python-tensorflow-cuda-1.6.0/third_party/gpus/cuda_configure.bzl
@@ -367,11 +367,20 @@ def find_cuda_define(repository_ctx, hea
   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:
