From 0015d40c015cf10c710895d928a70633afb5f3a1 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Wed, 1 Aug 2012 01:11:27 +0200 Subject: [PATCH] Use nanosecond precision in chpathtool when using Python >=3.3. --- bin/chpathtool.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/chpathtool.py b/bin/chpathtool.py index d0d49cb6d..85e608ea9 100755 --- a/bin/chpathtool.py +++ b/bin/chpathtool.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2011 Gentoo Foundation +# Copyright 2011-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import io @@ -121,8 +121,12 @@ def chpath_inplace(filename, is_text_file, old, new): f.close() if modified: - orig_mtime = orig_stat[stat.ST_MTIME] - os.utime(filename, (orig_mtime, orig_mtime)) + if sys.hexversion >= 0x3030000: + orig_mtime = orig_stat.st_mtime_ns + os.utime(filename, ns=(orig_mtime, orig_mtime)) + else: + orig_mtime = orig_stat[stat.ST_MTIME] + os.utime(filename, (orig_mtime, orig_mtime)) return modified def chpath_inplace_symlink(filename, st, old, new): -- 2.26.2