Updated python: account for lib64 when filtering compilers.

This commit is contained in:
Sergey Kosukhin 2016-12-08 13:36:18 +01:00
parent 58cb2cc2af
commit ec855df071

View File

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