From f913fd8ad9eccf99a2fefc1ecb620e1bac00bc8c Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sat, 10 Mar 2018 18:41:23 +0200 Subject: [PATCH] dvc: properly remove cached dir Signed-off-by: Ruslan Kuprieiev --- dvc/project.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/dvc/project.py b/dvc/project.py index dc5478849..7c147182e 100644 --- a/dvc/project.py +++ b/dvc/project.py @@ -176,26 +176,12 @@ class Project(object): os.chmod(cache, stat.S_IWRITE) os.unlink(cache) - def _remove_cache(self, cache): - if os.path.isfile(cache): - self._remove_cache_file(cache) - return - - for root, dirs, files in os.walk(cache, topdown=False): - for dname in dirs: - path = os.path.join(root, dname) - os.rmdir(path) - for fname in files: - path = os.path.join(root, fname) - self._remove_cache_file(path) - os.rmdir(cache) - def gc(self): clist = self._used_cache() for cache in self.cache.all(): if cache in clist: continue - self._remove_cache(cache) + self._remove_cache_file(cache) self.logger.info(u'\'{}\' was removed'.format(self.to_dvc_path(cache))) def push(self, target=None, jobs=1):