Merge pull request #574 from LLNL/features/flattener
Created flatten_dependencies function
This commit is contained in:
commit
741bea032c
@ -188,3 +188,6 @@
|
|||||||
import spack.util.executable
|
import spack.util.executable
|
||||||
from spack.util.executable import *
|
from spack.util.executable import *
|
||||||
__all__ += spack.util.executable.__all__
|
__all__ += spack.util.executable.__all__
|
||||||
|
|
||||||
|
from spack.package import install_dependency_symlinks, flatten_dependencies, DependencyConflictError
|
||||||
|
__all__ += ['install_dependency_symlinks', 'flatten_dependencies', 'DependencyConflictError']
|
||||||
|
@ -1243,6 +1243,27 @@ def rpath_args(self):
|
|||||||
return " ".join("-Wl,-rpath,%s" % p for p in self.rpath)
|
return " ".join("-Wl,-rpath,%s" % p for p in self.rpath)
|
||||||
|
|
||||||
|
|
||||||
|
def install_dependency_symlinks(pkg, spec, prefix):
|
||||||
|
"""Execute a dummy install and flatten dependencies"""
|
||||||
|
flatten_dependencies(spec, prefix)
|
||||||
|
|
||||||
|
def flatten_dependencies(spec, flat_dir):
|
||||||
|
"""Make each dependency of spec present in dir via symlink."""
|
||||||
|
for dep in spec.traverse(root=False):
|
||||||
|
name = dep.name
|
||||||
|
|
||||||
|
dep_path = spack.install_layout.path_for_spec(dep)
|
||||||
|
dep_files = LinkTree(dep_path)
|
||||||
|
|
||||||
|
os.mkdir(flat_dir+'/'+name)
|
||||||
|
|
||||||
|
conflict = dep_files.find_conflict(flat_dir+'/'+name)
|
||||||
|
if conflict:
|
||||||
|
raise DependencyConflictError(conflict)
|
||||||
|
|
||||||
|
dep_files.merge(flat_dir+'/'+name)
|
||||||
|
|
||||||
|
|
||||||
def validate_package_url(url_string):
|
def validate_package_url(url_string):
|
||||||
"""Determine whether spack can handle a particular URL or not."""
|
"""Determine whether spack can handle a particular URL or not."""
|
||||||
url = urlparse(url_string)
|
url = urlparse(url_string)
|
||||||
@ -1380,3 +1401,11 @@ def __init__(self, path):
|
|||||||
class ActivationError(ExtensionError):
|
class ActivationError(ExtensionError):
|
||||||
def __init__(self, msg, long_msg=None):
|
def __init__(self, msg, long_msg=None):
|
||||||
super(ActivationError, self).__init__(msg, long_msg)
|
super(ActivationError, self).__init__(msg, long_msg)
|
||||||
|
|
||||||
|
|
||||||
|
class DependencyConflictError(spack.error.SpackError):
|
||||||
|
"""Raised when the dependencies cannot be flattened as asked for."""
|
||||||
|
def __init__(self, conflict):
|
||||||
|
super(DependencyConflictError, self).__init__(
|
||||||
|
"%s conflicts with another file in the flattened directory." %(
|
||||||
|
conflict))
|
||||||
|
Loading…
Reference in New Issue
Block a user