From 00a893aa79b076cb5403184a2871dc43355f7aff Mon Sep 17 00:00:00 2001 From: Oliver Breitwieser Date: Mon, 18 Sep 2017 09:26:22 -0400 Subject: link_tree: support choosing the link function This can be used to make hardlinks rather than symlinks. --- lib/spack/llnl/util/link_tree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/spack/llnl/util/link_tree.py b/lib/spack/llnl/util/link_tree.py index 940526dd5c..33a16d71a9 100644 --- a/lib/spack/llnl/util/link_tree.py +++ b/lib/spack/llnl/util/link_tree.py @@ -64,7 +64,7 @@ class LinkTree(object): return dest return None - def merge(self, dest_root, **kwargs): + def merge(self, dest_root, link=os.symlink, **kwargs): """Link all files in src into dest, creating directories if necessary. If ignore_conflicts is True, do not break when the target exists but @@ -95,7 +95,7 @@ class LinkTree(object): else: raise AssertionError("File already exists: %s" % dest) else: - os.symlink(src, dest) + link(src, dest) if ignore_conflicts: return existing -- cgit v1.2.3-60-g2f50