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
@ -64,7 +64,7 @@ def find_conflict(self, dest_root, **kwargs):
|
|||||||
return dest
|
return dest
|
||||||
return None
|
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
|
"""Link all files in src into dest, creating directories
|
||||||
if necessary.
|
if necessary.
|
||||||
If ignore_conflicts is True, do not break when the target exists but
|
If ignore_conflicts is True, do not break when the target exists but
|
||||||
@ -95,7 +95,7 @@ def merge(self, dest_root, **kwargs):
|
|||||||
else:
|
else:
|
||||||
raise AssertionError("File already exists: %s" % dest)
|
raise AssertionError("File already exists: %s" % dest)
|
||||||
else:
|
else:
|
||||||
os.symlink(src, dest)
|
link(src, dest)
|
||||||
if ignore_conflicts:
|
if ignore_conflicts:
|
||||||
return existing
|
return existing
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user