Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] bin/doins.py: avoid timestamp precision loss with python2 (bug 642632)
Date: Mon, 15 Jan 2018 04:50:32
Message-Id: 20180115044740.59034-1-zmedico@gentoo.org
1 Since conversion to/from float results in timestamp precision loss
2 with less than Python 3.3, do not use the python implementation
3 in this case.
4
5 Bug: https://bugs.gentoo.org/642632
6 Fixes: d459f05ff71f ("bin/doins.py: implement install -p option (bug 642632)")
7 ---
8 bin/doins.py | 4 ++++
9 1 file changed, 4 insertions(+)
10
11 diff --git a/bin/doins.py b/bin/doins.py
12 index 9e6566097..6bc30c90b 100644
13 --- a/bin/doins.py
14 +++ b/bin/doins.py
15 @@ -110,6 +110,10 @@ def _parse_install_options(
16 parser.add_argument('-p', '--preserve-timestamps', action='store_true')
17 split_options = shlex.split(options)
18 namespace, remaining = parser.parse_known_args(split_options)
19 + if namespace.preserve_timestamps and sys.version_info < (3, 3):
20 + # -p is not supported in this case, since timestamps cannot
21 + # be preserved with full precision
22 + remaining.append('-p')
23 # Because parsing '--mode' option is partially supported. If unknown
24 # arg for --mode is passed, namespace.mode is set to None.
25 if remaining or namespace.mode is None:
26 --
27 2.13.6