Description: Path .so file loader to use SOABI suffix appended by dh-python
 Might be forwarded upstream with additional work to check all valid
 imp.C_EXTENSION from imp.get_suffixes but I have the feeling upstream
 doesn't give a shit of doing things right. I'll just spare my time.
 .
 python-tensorflow-cuda (1.2.1-1) unstable; urgency=medium
 .
   * Initial release.
Author: Adam Cecile <acecile@le-vert.net>

---
Origin: other
Forwarded: no
Last-Update: 2017-08-29

Index: python-tensorflow-cuda-1.8.0/tensorflow/contrib/util/loader.py
===================================================================
--- python-tensorflow-cuda-1.8.0.orig/tensorflow/contrib/util/loader.py
+++ python-tensorflow-cuda-1.8.0/tensorflow/contrib/util/loader.py
@@ -22,6 +22,7 @@ from __future__ import print_function
 
 import os
 import re
+from imp import get_suffixes, C_EXTENSION
 
 from tensorflow.python.framework import load_library
 from tensorflow.python.platform import resource_loader
@@ -52,6 +53,9 @@ def load_op_library(path):
     # TODO(mrry): Once we have all of them this check should be removed.
     if not os.path.exists(path):
       return None
+  # Debianize the path to so file which has been suffixed with arch and Python version
+  best_suffix = [ suffix for suffix in get_suffixes() if suffix[2] == C_EXTENSION ][0][0]
+  path = re.sub(r'\.so$', best_suffix, path)
   path = resource_loader.get_path_to_datafile(path)
   ret = load_library.load_op_library(path)
   assert ret, 'Could not load %s' % path
