summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-03-31 11:37:09 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2016-03-31 11:37:09 -0700
commit220c72d67fad2ebb8e70adae8b3389ddec689f1b (patch)
tree62b63852ae445c45a88269f09e9c23e5e5437d92 /lib
parenta670408617b76777d35185aa554eeaf3892e0188 (diff)
parente049fc2840ba81cdff2ca7edd798c5e961ae94e9 (diff)
downloadspack-220c72d67fad2ebb8e70adae8b3389ddec689f1b.tar.gz
spack-220c72d67fad2ebb8e70adae8b3389ddec689f1b.tar.bz2
spack-220c72d67fad2ebb8e70adae8b3389ddec689f1b.tar.xz
spack-220c72d67fad2ebb8e70adae8b3389ddec689f1b.zip
Merge branch 'features/blas-lapack-hardening' into develop
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/llnl/util/filesystem.py18
-rw-r--r--lib/spack/spack/build_environment.py8
-rw-r--r--lib/spack/spack/package.py6
3 files changed, 28 insertions, 4 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py
index 46ca03bec4..70d46a7f77 100644
--- a/lib/spack/llnl/util/filesystem.py
+++ b/lib/spack/llnl/util/filesystem.py
@@ -27,7 +27,8 @@ __all__ = ['set_install_permissions', 'install', 'install_tree', 'traverse_tree'
'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
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 119a255a34..640db0c1d1 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -59,6 +59,11 @@ SPACK_SHORT_SPEC = 'SPACK_SHORT_SPEC'
SPACK_DEBUG_LOG_DIR = 'SPACK_DEBUG_LOG_DIR'
+# Platform-specific library suffix.
+dso_suffix = 'dylib' if sys.platform == 'darwin' else 'so'
+
+
+
class MakeExecutable(Executable):
"""Special callable executable object for make so the user can
specify parallel or not on a per-invocation basis. Using
@@ -246,6 +251,9 @@ def set_module_variables_for_package(pkg, module):
# a Prefix object.
m.prefix = pkg.prefix
+ # Platform-specific library suffix.
+ m.dso_suffix = dso_suffix
+
def get_rpaths(pkg):
"""Get a list of all the rpaths for a package."""
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 9dcfbee661..4065553131 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -929,6 +929,9 @@ class Package(object):
install(env_path, env_install_path)
dump_packages(self.spec, packages_dir)
+ # Run post install hooks before build stage is removed.
+ spack.hooks.post_install(self)
+
# Stop timer.
self._total_time = time.time() - start_time
build_time = self._total_time - self._fetch_time
@@ -957,9 +960,6 @@ class Package(object):
# the database, so that we don't need to re-read from file.
spack.installed_db.add(self.spec, self.prefix)
- # Once everything else is done, run post install hooks
- spack.hooks.post_install(self)
-
def sanity_check_prefix(self):
"""This function checks whether install succeeded."""