From dad8051be9f2ad78dcd0500bdec78ff6c32d6840 Mon Sep 17 00:00:00 2001 From: Mike Khiretskiy Date: Thu, 24 Sep 2015 15:53:25 +0300 Subject: [PATCH] =?UTF-8?q?os.rename=20=D0=B7=D0=B0=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=91=D0=BD=20=D0=BD=D0=B0=20shutil.move?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/update/profile.py | 2 +- pym/update/update.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pym/update/profile.py b/pym/update/profile.py index bd269c3..2a14eaf 100644 --- a/pym/update/profile.py +++ b/pym/update/profile.py @@ -194,7 +194,7 @@ class ProfileRepository(object): rpath_new = path.join(storage.directory, repo_name) if path.exists(rpath_new): removeDir(rpath_new) - os.rename(rpath, rpath_new) + shutil.move(rpath, rpath_new) pr = cls(repo_name, storage) return pr diff --git a/pym/update/update.py b/pym/update/update.py index b47741f..2444f29 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -33,6 +33,7 @@ from calculate.update.datavars import DataVarsUpdate from calculate.update.update_info import UpdateInfo from calculate.lib.cl_log import log import re +import shutil from collections import MutableSet from update_tasks import EmergeMark @@ -310,7 +311,7 @@ class Update(object): self._syncRepository(repname, url, rpath_new, revision, cb_progress=self.setProgress) removeDir(rpath) - os.rename(rpath_new, rpath) + shutil.move(rpath_new, rpath) except OSError as e: raise UpdateError(_("Failed to modify the " "{repname} repository").format( @@ -349,7 +350,7 @@ class Update(object): cachename) + ".stash") if path.exists(cachedir_s): removeDir(cachedir_s) - os.rename(cachedir, cachedir_s) + shutil.move(cachedir, cachedir_s) except BaseException as e: pass @@ -378,7 +379,7 @@ class Update(object): path.basename(cachename)+".stash") if path.exists(cachedir_s): try: - os.rename(cachedir_s, cachedir) + shutil.move(cachedir_s, cachedir) except BaseException as e: pass else: