Created flatten_dependencies function that dummy packages can use to create sane install environments.
This commit is contained in:
parent
b93a2ba1cf
commit
1fa38689d8
@ -33,6 +33,7 @@
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import join_path, mkdirp
|
||||
from llnl.util.link_tree import *
|
||||
|
||||
from spack.spec import Spec
|
||||
from spack.error import SpackError
|
||||
@ -131,6 +132,23 @@ def remove_extension(self, spec, ext_spec):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
def flatten_dependencies(self, 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 = self.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 path_for_spec(self, spec):
|
||||
"""Return an absolute path from the root to a directory for the spec."""
|
||||
_check_concrete(spec)
|
||||
|
Loading…
Reference in New Issue
Block a user