Skip to content

Commit

Permalink
fallback to copy if link fails
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Oct 9, 2018
1 parent b9bd855 commit 46f4e84
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/tox/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,16 @@ def create_session_view(package, temp_dir, report):
session_package = session_dir.join(package.basename)

# if we can do hard links do that, otherwise just copy
operation = "links"
links = False
if hasattr(os, "link"):
os.link(str(package), str(session_package))
else:
operation = "copied"
try:
os.link(str(package), str(session_package))
links = True
except (OSError, NotImplementedError):
pass
if not links:
package.copy(session_package)
operation = "links" if links else "copied"
common = session_package.common(package)
report.verbosity1(
"package {} {} to {} ({})".format(
Expand Down

0 comments on commit 46f4e84

Please sign in to comment.