utils: fs: remove unused fs_copy

This commit is contained in:
Ruslan Kuprieiev
2021-11-11 01:26:37 +02:00
parent ab56e4bb9b
commit 7e3e257c7f
2 changed files with 10 additions and 9 deletions
-7
View File
@@ -22,13 +22,6 @@ umask = os.umask(0)
os.umask(umask)
def fs_copy(src, dst, ignore=None):
if os.path.isdir(src):
shutil.copytree(src, dst, ignore=ignore)
else:
shutil.copy2(src, dst)
def get_inode(path):
inode = System.inode(path)
logger.trace("Path '%s' inode '%d'", path, inode)
+10 -2
View File
@@ -290,6 +290,15 @@ class PosixTmpDir(TmpDir, pathlib.PurePosixPath):
CACHE = {}
def _fs_copy(src, dst, ignore=None):
import shutil
if os.path.isdir(src):
shutil.copytree(src, dst, ignore=ignore)
else:
shutil.copy2(src, dst)
@pytest.fixture(scope="session")
def make_tmp_dir(tmp_path_factory, request, worker_id):
def make(name, *, scm=False, dvc=False, subdir=False):
@@ -297,7 +306,6 @@ def make_tmp_dir(tmp_path_factory, request, worker_id):
from dvc.repo import Repo
from dvc.scm.git import Git
from dvc.utils.fs import fs_copy
cache = CACHE.get((scm, dvc, subdir))
if not cache:
@@ -311,7 +319,7 @@ def make_tmp_dir(tmp_path_factory, request, worker_id):
ignore = ignore_patterns("cache.db*")
for entry in os.listdir(cache):
# shutil.copytree's dirs_exist_ok is only available in >=3.8
fs_copy(
_fs_copy(
os.path.join(cache, entry),
os.path.join(path, entry),
ignore=ignore,