1 |
commit: 90abd1ee06f66fe094c87763e501a64be82915c5 |
2 |
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org> |
3 |
AuthorDate: Thu Nov 29 20:30:35 2012 +0000 |
4 |
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com> |
5 |
CommitDate: Thu Nov 29 20:30:35 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=90abd1ee |
7 |
|
8 |
Fix return value of portage.util.movefile.movefile() for symlinks with Python >=3.3. |
9 |
|
10 |
--- |
11 |
pym/portage/util/movefile.py | 7 +++++-- |
12 |
1 files changed, 5 insertions(+), 2 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py |
15 |
index b9c4183..98cf86a 100644 |
16 |
--- a/pym/portage/util/movefile.py |
17 |
+++ b/pym/portage/util/movefile.py |
18 |
@@ -163,8 +163,11 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, |
19 |
raise |
20 |
lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID]) |
21 |
# utime() only works on the target of a symlink, so it's not |
22 |
- # possible to perserve mtime on symlinks. |
23 |
- return os.lstat(dest)[stat.ST_MTIME] |
24 |
+ # possible to preserve mtime on symlinks. |
25 |
+ if sys.hexversion >= 0x3030000: |
26 |
+ return os.stat(dest, follow_symlinks=False).st_mtime_ns |
27 |
+ else: |
28 |
+ return os.lstat(dest)[stat.ST_MTIME] |
29 |
except SystemExit as e: |
30 |
raise |
31 |
except Exception as e: |