link_tree: support choosing the link function
This can be used to make hardlinks rather than symlinks.
This commit is contained in:
parent
9024ddcf05
commit
00a893aa79
1 changed files with 2 additions and 2 deletions
|
@ -64,7 +64,7 @@ def find_conflict(self, dest_root, **kwargs):
|
|||
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 @@ def merge(self, dest_root, **kwargs):
|
|||
else:
|
||||
raise AssertionError("File already exists: %s" % dest)
|
||||
else:
|
||||
os.symlink(src, dest)
|
||||
link(src, dest)
|
||||
if ignore_conflicts:
|
||||
return existing
|
||||
|
||||
|
|
Loading…
Reference in a new issue