Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions dvc/system.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import errno
import logging
import os
import shutil
import platform

from dvc.compat import fspath
from dvc.exceptions import DvcException
Expand All @@ -18,7 +18,20 @@ def is_unix():
@staticmethod
def copy(src, dest):
src, dest = fspath(src), fspath(dest)
return shutil.copyfile(src, dest)
system = platform.system()
if system == "Windows":
import speedcopy

return speedcopy.copyfile(src, dest)
else:
import shutil
import sys

if sys.version_info < (3, 8):
# Importing the module monkey-patches shutil.copyfile
import pyfastcopy # noqa: F401

return shutil.copyfile(src, dest)

@staticmethod
def hardlink(source, link_name):
Expand Down Expand Up @@ -90,8 +103,6 @@ def _reflink_linux(src, dst):

@staticmethod
def reflink(source, link_name):
import platform

source, link_name = fspath(source), fspath(link_name)

system = platform.system()
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def run(self):
"win-unicode-console>=0.5; sys_platform == 'win32'",
"pywin32>=225; sys_platform == 'win32'",
"networkx>=2.1,<2.4",
"speedcopy @ git+https://github.com/rxxg/speedcopy@5",
"pyfastcopy>=1.0.3",
]


Expand Down