diff options
author | Michał Górny <mgorny@gentoo.org> | 2020-07-17 06:34:00 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2020-07-17 06:39:07 +0200 |
commit | 55a6bfdd9d3e2b8d0a59f5579de962fb82dde8ca (patch) | |
tree | 6cddd32d478764b7736e62c6c455da956966ee67 /bin | |
parent | Remove support code for Python < 3.2 (diff) | |
download | portage-55a6bfdd9d3e2b8d0a59f5579de962fb82dde8ca.tar.gz portage-55a6bfdd9d3e2b8d0a59f5579de962fb82dde8ca.tar.bz2 portage-55a6bfdd9d3e2b8d0a59f5579de962fb82dde8ca.zip |
Remove support code for Python < 3.3
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/chpathtool.py | 8 | ||||
-rw-r--r-- | bin/doins.py | 14 |
2 files changed, 3 insertions, 19 deletions
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): |