From 55a6bfdd9d3e2b8d0a59f5579de962fb82dde8ca Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Fri, 17 Jul 2020 06:34:00 +0200 Subject: Remove support code for Python < 3.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- bin/chpathtool.py | 8 ++------ bin/doins.py | 14 +------------- 2 files changed, 3 insertions(+), 19 deletions(-) (limited to 'bin') diff --git a/bin/chpathtool.py b/bin/chpathtool.py index fbd18b987..c036046ae 100755 --- a/bin/chpathtool.py +++ b/bin/chpathtool.py @@ -128,12 +128,8 @@ def chpath_inplace(filename, is_text_file, old, new): f.close() if modified: - 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)) + orig_mtime = orig_stat.st_mtime_ns + os.utime(filename, ns=(orig_mtime, orig_mtime)) return modified def chpath_inplace_symlink(filename, st, old, new): diff --git a/bin/doins.py b/bin/doins.py index 98dc4f810..a08e3f8c9 100644 --- a/bin/doins.py +++ b/bin/doins.py @@ -110,10 +110,6 @@ def _parse_install_options( parser.add_argument('-p', '--preserve-timestamps', action='store_true') split_options = shlex.split(options) namespace, remaining = parser.parse_known_args(split_options) - if namespace.preserve_timestamps and sys.version_info < (3, 3): - # -p is not supported in this case, since timestamps cannot - # be preserved with full precision - remaining.append('-p') # Because parsing '--mode' option is partially supported. If unknown # arg for --mode is passed, namespace.mode is set to None. if remaining or namespace.mode is None: @@ -151,15 +147,7 @@ def _set_timestamps(source_stat, dest): source_stat: stat result for the source file. dest: path to the dest file. """ - os.utime(dest, (source_stat.st_atime, source_stat.st_mtime)) - - -if sys.version_info >= (3, 3): - def _set_timestamps_ns(source_stat, dest): - os.utime(dest, ns=(source_stat.st_atime_ns, source_stat.st_mtime_ns)) - - _set_timestamps_ns.__doc__ = _set_timestamps.__doc__ - _set_timestamps = _set_timestamps_ns + os.utime(dest, ns=(source_stat.st_atime_ns, source_stat.st_mtime_ns)) class _InsInProcessInstallRunner(object): -- cgit v1.2.3-65-gdbad