From ec855df071acaa758d40a18074a955e5effc9321 Mon Sep 17 00:00:00 2001
From: Sergey Kosukhin <skosukhin@gmail.com>
Date: Thu, 8 Dec 2016 13:36:18 +0100
Subject: [PATCH] Updated python: account for lib64 when filtering compilers.

---
 .../repos/builtin/packages/python/package.py  | 36 +++++++++----------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index 55c73e581c..2eab9fa558 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -132,19 +132,17 @@ def install(self, spec, prefix):
         make()
         make('install')
 
-        self.filter_compilers(spec, prefix)
+        self.filter_compilers(prefix)
 
         # TODO:
         # On OpenSuse 13, python uses <prefix>/lib64/python2.7/lib-dynload/*.so
         # instead of <prefix>/lib/python2.7/lib-dynload/*.so. Oddly enough the
         # result is that Python can not find modules like cPickle. A workaround
         # for now is to symlink to `lib`:
-        src = os.path.join(prefix,
-                           'lib64',
+        src = os.path.join(prefix.lib64,
                            'python{0}'.format(self.version.up_to(2)),
                            'lib-dynload')
-        dst = os.path.join(prefix,
-                           'lib',
+        dst = os.path.join(prefix.lib,
                            'python{0}'.format(self.version.up_to(2)),
                            'lib-dynload')
         if os.path.isdir(src) and not os.path.isdir(dst):
@@ -174,7 +172,7 @@ def install(self, spec, prefix):
     #            >>> import Tkinter
     #            >>> Tkinter._test()
 
-    def filter_compilers(self, spec, prefix):
+    def filter_compilers(self, prefix):
         """Run after install to tell the configuration files and Makefiles
         to use the compilers that Spack built the package with.
 
@@ -184,23 +182,21 @@ def filter_compilers(self, spec, prefix):
 
         kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
 
-        dirname = join_path(prefix.lib,
-                            'python{0}'.format(self.version.up_to(2)))
+        lib_dirnames = [
+            join_path(lib_dir, 'python{0}'.format(self.version.up_to(2))) for
+            lib_dir in [prefix.lib, prefix.lib64]]
 
-        config = 'config'
-        if spec.satisfies('@3:'):
-            config = 'config-{0}m'.format(self.version.up_to(2))
+        config_dirname = 'config-{0}m'.format(
+            self.version.up_to(2)) if self.spec.satisfies('@3:') else 'config'
 
-        files = [
-            '_sysconfigdata.py',
-            join_path(config, 'Makefile')
-        ]
+        rel_filenames = ['_sysconfigdata.py',
+                         join_path(config_dirname, 'Makefile')]
+
+        abs_filenames = [join_path(dirname, filename) for dirname in
+                         lib_dirnames for filename in rel_filenames]
 
-        for filename in files:
-            filter_file(env['CC'], self.compiler.cc,
-                        join_path(dirname, filename), **kwargs)
-            filter_file(env['CXX'], self.compiler.cxx,
-                        join_path(dirname, filename), **kwargs)
+        filter_file(env['CC'], self.compiler.cc, *abs_filenames, **kwargs)
+        filter_file(env['CXX'], self.compiler.cxx, *abs_filenames, **kwargs)
 
     # ========================================================================
     # Set up environment to make install easy for python extensions.
-- 
GitLab