Fix return value of portage.util.movefile.movefile() for symlinks with Python >=3.3.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Thu, 29 Nov 2012 20:30:35 +0000 (21:30 +0100)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Thu, 29 Nov 2012 20:30:35 +0000 (21:30 +0100)
pym/portage/util/movefile.py

index b9c418347f3bef284a411282fd8edc1c41aeb66c..98cf86a417ff1520cee8475e51cb71fb5e3f73b1 100644 (file)
@@ -163,8 +163,11 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
                                        raise
                        lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
                        # utime() only works on the target of a symlink, so it's not
-                       # possible to perserve mtime on symlinks.
-                       return os.lstat(dest)[stat.ST_MTIME]
+                       # possible to preserve mtime on symlinks.
+                       if sys.hexversion >= 0x3030000:
+                               return os.stat(dest, follow_symlinks=False).st_mtime_ns
+                       else:
+                               return os.lstat(dest)[stat.ST_MTIME]
                except SystemExit as e:
                        raise
                except Exception as e: