mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Merge pull request #2173 from efiop/master
dvc: use remove() instead of shutil.rmtree()
This commit is contained in:
@@ -12,6 +12,7 @@ from dvc.config import Config
|
||||
from dvc.cache import CacheConfig
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.utils.compat import makedirs, str
|
||||
from dvc.utils import remove
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -120,7 +121,7 @@ class ExternalRepo(object):
|
||||
self._install_to(tmp_dir, cache_dir)
|
||||
except ExternalRepoError:
|
||||
if os.path.exists(tmp_dir):
|
||||
shutil.rmtree(tmp_dir)
|
||||
remove(tmp_dir)
|
||||
raise
|
||||
|
||||
if self.installed:
|
||||
@@ -137,7 +138,7 @@ class ExternalRepo(object):
|
||||
)
|
||||
return
|
||||
|
||||
shutil.rmtree(self.path)
|
||||
remove(self.path)
|
||||
|
||||
def update(self):
|
||||
self.repo.scm.fetch(self.rev)
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import shutil
|
||||
from dvc.utils import remove
|
||||
|
||||
|
||||
def destroy(self):
|
||||
for stage in self.stages():
|
||||
stage.remove(remove_outs=False)
|
||||
|
||||
shutil.rmtree(self.dvc_dir)
|
||||
remove(self.dvc_dir)
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
import os
|
||||
import shutil
|
||||
import shortuuid
|
||||
|
||||
from dvc.config import Config
|
||||
from dvc.path_info import PathInfo
|
||||
from dvc.external_repo import ExternalRepo
|
||||
from dvc.utils.compat import urlparse
|
||||
from dvc.utils import remove
|
||||
|
||||
|
||||
@staticmethod
|
||||
@@ -45,4 +45,4 @@ def get(url, path, out=None, rev=None):
|
||||
erepo.repo.scm.git.close()
|
||||
finally:
|
||||
if os.path.exists(tmp_dir):
|
||||
shutil.rmtree(tmp_dir)
|
||||
remove(tmp_dir)
|
||||
|
||||
+2
-4
@@ -1,5 +1,4 @@
|
||||
import os
|
||||
import shutil
|
||||
import colorama
|
||||
import logging
|
||||
|
||||
@@ -7,8 +6,7 @@ from dvc.repo import Repo
|
||||
from dvc.scm import SCM, NoSCM
|
||||
from dvc.config import Config
|
||||
from dvc.exceptions import InitError
|
||||
from dvc.utils import boxify
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils import boxify, relpath, remove
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -78,7 +76,7 @@ def init(root_dir=os.curdir, no_scm=False, force=False):
|
||||
)
|
||||
)
|
||||
|
||||
shutil.rmtree(dvc_dir)
|
||||
remove(dvc_dir)
|
||||
|
||||
os.mkdir(dvc_dir)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user