From: Arfrever Frehtes Taifersar Arahesis Date: Tue, 31 Jul 2012 23:11:27 +0000 (+0200) Subject: Use nanosecond precision in chpathtool when using Python >=3.3. X-Git-Tag: v2.2.0_alpha121~19 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=0015d40c015cf10c710895d928a70633afb5f3a1;p=portage.git Use nanosecond precision in chpathtool when using Python >=3.3. --- 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):