Merge branch 'features/blas-lapack-hardening' into develop

This commit is contained in:
Todd Gamblin
2016-03-31 11:37:09 -07:00
6 changed files with 116 additions and 20 deletions

View File

@@ -27,7 +27,8 @@
'force_remove', 'join_path', 'ancestor', 'can_access', 'filter_file',
'FileFilter', 'change_sed_delimiter', 'is_exe', 'force_symlink',
'set_executable', 'copy_mode', 'unset_executable_mode',
'remove_dead_links', 'remove_linked_tree', 'fix_darwin_install_name']
'remove_dead_links', 'remove_linked_tree', 'find_library_path',
'fix_darwin_install_name']
import os
import glob
@@ -395,6 +396,7 @@ def remove_linked_tree(path):
else:
shutil.rmtree(path, True)
def fix_darwin_install_name(path):
"""
Fix install name of dynamic libraries on Darwin to have full path.
@@ -420,3 +422,17 @@ def fix_darwin_install_name(path):
if dep == os.path.basename(loc):
subprocess.Popen(["install_name_tool", "-change",dep,loc,lib], stdout=subprocess.PIPE).communicate()[0]
break
def find_library_path(libname, *paths):
"""Searches for a file called <libname> in each path.
Return:
directory where the library was found, if found. None otherwise.
"""
for path in paths:
library = join_path(path, libname)
if os.path.exists(library):
return path
return None