1 |
commit: 9a353d3759f70043023eb36491ece0b9a8cdba6b |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Nov 29 03:09:10 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 29 03:09:10 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9a353d37 |
7 |
|
8 |
movefile: avoid redundant string concatenations |
9 |
|
10 |
--- |
11 |
pym/portage/util/movefile.py | 13 +++++++------ |
12 |
1 files changed, 7 insertions(+), 6 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py |
15 |
index 70ecb60..c205fe9 100644 |
16 |
--- a/pym/portage/util/movefile.py |
17 |
+++ b/pym/portage/util/movefile.py |
18 |
@@ -169,15 +169,16 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, |
19 |
if renamefailed: |
20 |
didcopy=0 |
21 |
if stat.S_ISREG(sstat[stat.ST_MODE]): |
22 |
+ dest_tmp = dest + "#new" |
23 |
try: # For safety copy then move it over. |
24 |
if selinux_enabled: |
25 |
- selinux.copyfile(src, dest + "#new") |
26 |
- _copyxattr(src, dest + "#new") |
27 |
- selinux.rename(dest + "#new", dest) |
28 |
+ selinux.copyfile(src, dest_tmp) |
29 |
+ _copyxattr(src, dest_tmp) |
30 |
+ selinux.rename(dest_tmp, dest) |
31 |
else: |
32 |
- shutil.copyfile(src, dest + "#new") |
33 |
- _copyxattr(src, dest + "#new") |
34 |
- os.rename(dest + "#new", dest) |
35 |
+ shutil.copyfile(src, dest_tmp) |
36 |
+ _copyxattr(src, dest_tmp) |
37 |
+ os.rename(dest_tmp, dest) |
38 |
didcopy=1 |
39 |
except SystemExit as e: |
40 |
raise |