1 |
commit: 0015d40c015cf10c710895d928a70633afb5f3a1 |
2 |
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org> |
3 |
AuthorDate: Tue Jul 31 23:11:27 2012 +0000 |
4 |
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Jul 31 23:11:27 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0015d40c |
7 |
|
8 |
Use nanosecond precision in chpathtool when using Python >=3.3. |
9 |
|
10 |
--- |
11 |
bin/chpathtool.py | 10 +++++++--- |
12 |
1 files changed, 7 insertions(+), 3 deletions(-) |
13 |
|
14 |
diff --git a/bin/chpathtool.py b/bin/chpathtool.py |
15 |
index d0d49cb..85e608e 100755 |
16 |
--- a/bin/chpathtool.py |
17 |
+++ b/bin/chpathtool.py |
18 |
@@ -1,5 +1,5 @@ |
19 |
#!/usr/bin/python |
20 |
-# Copyright 2011 Gentoo Foundation |
21 |
+# Copyright 2011-2012 Gentoo Foundation |
22 |
# Distributed under the terms of the GNU General Public License v2 |
23 |
|
24 |
import io |
25 |
@@ -121,8 +121,12 @@ def chpath_inplace(filename, is_text_file, old, new): |
26 |
|
27 |
f.close() |
28 |
if modified: |
29 |
- orig_mtime = orig_stat[stat.ST_MTIME] |
30 |
- os.utime(filename, (orig_mtime, orig_mtime)) |
31 |
+ if sys.hexversion >= 0x3030000: |
32 |
+ orig_mtime = orig_stat.st_mtime_ns |
33 |
+ os.utime(filename, ns=(orig_mtime, orig_mtime)) |
34 |
+ else: |
35 |
+ orig_mtime = orig_stat[stat.ST_MTIME] |
36 |
+ os.utime(filename, (orig_mtime, orig_mtime)) |
37 |
return modified |
38 |
|
39 |
def chpath_inplace_symlink(filename, st, old, new): |