Skip to content

Commit

Permalink
utils: fs: remove unused fs_copy
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Nov 10, 2021
1 parent ab56e4b commit 7e3e257
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 0 additions & 7 deletions dvc/utils/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@
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)
Expand Down
12 changes: 10 additions & 2 deletions tests/dir_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,22 @@ 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):
from shutil import ignore_patterns

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:
Expand All @@ -311,7 +319,7 @@ def make(name, *, scm=False, dvc=False, subdir=False):
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,
Expand Down

0 comments on commit 7e3e257

Please sign in to comment.