aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-11-28 19:09:10 -0800
committerZac Medico <zmedico@gentoo.org>2011-11-28 19:09:10 -0800
commit9a353d3759f70043023eb36491ece0b9a8cdba6b (patch)
treed55c4d919be518fa907bacd7843eef6ca1e46226 /pym/portage/util/movefile.py
parentmovefile: remove unused lchown (diff)
downloadportage-9a353d3759f70043023eb36491ece0b9a8cdba6b.tar.gz
portage-9a353d3759f70043023eb36491ece0b9a8cdba6b.tar.bz2
portage-9a353d3759f70043023eb36491ece0b9a8cdba6b.zip
movefile: avoid redundant string concatenations
Diffstat (limited to 'pym/portage/util/movefile.py')
-rw-r--r--pym/portage/util/movefile.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 70ecb6010..c205fe934 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -169,15 +169,16 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
if renamefailed:
didcopy=0
if stat.S_ISREG(sstat[stat.ST_MODE]):
+ dest_tmp = dest + "#new"
try: # For safety copy then move it over.
if selinux_enabled:
- selinux.copyfile(src, dest + "#new")
- _copyxattr(src, dest + "#new")
- selinux.rename(dest + "#new", dest)
+ selinux.copyfile(src, dest_tmp)
+ _copyxattr(src, dest_tmp)
+ selinux.rename(dest_tmp, dest)
else:
- shutil.copyfile(src, dest + "#new")
- _copyxattr(src, dest + "#new")
- os.rename(dest + "#new", dest)
+ shutil.copyfile(src, dest_tmp)
+ _copyxattr(src, dest_tmp)
+ os.rename(dest_tmp, dest)
didcopy=1
except SystemExit as e:
raise