diff options
author | Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> | 2012-08-01 01:11:27 +0200 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> | 2012-08-01 01:11:27 +0200 |
commit | 0015d40c015cf10c710895d928a70633afb5f3a1 (patch) | |
tree | 5f924b8a0def8091253c3947200297c3e54ab798 | |
parent | 907adbeeb89176c63ad7a04288e080f08f3eb401 (diff) | |
download | portage-0015d40c015cf10c710895d928a70633afb5f3a1.tar.gz portage-0015d40c015cf10c710895d928a70633afb5f3a1.tar.bz2 portage-0015d40c015cf10c710895d928a70633afb5f3a1.zip |
Use nanosecond precision in chpathtool when using Python >=3.3.
-rwxr-xr-x | bin/chpathtool.py | 10 |
1 files 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): |