From d67fece1b741c0aae609436cd83ac0d2c448092c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 21 Dec 2009 03:03:51 +0000 Subject: When integer mtime is desired, use stat_obj[stat.ST_MTIME] instead of the float st_mtime in order to avoid rounding *up* in some rare cases. svn path=/main/trunk/; revision=15125 --- pym/_emerge/BinpkgFetcher.py | 3 ++- pym/_emerge/actions.py | 2 +- pym/_emerge/main.py | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'pym/_emerge') diff --git a/pym/_emerge/BinpkgFetcher.py b/pym/_emerge/BinpkgFetcher.py index fbf34df72..bd8b141f3 100644 --- a/pym/_emerge/BinpkgFetcher.py +++ b/pym/_emerge/BinpkgFetcher.py @@ -7,6 +7,7 @@ try: from urllib.parse import urlparse as urllib_parse_urlparse except ImportError: from urlparse import urlparse as urllib_parse_urlparse +import stat import sys import portage from portage import os @@ -115,7 +116,7 @@ class BinpkgFetcher(SpawnProcess): pass else: try: - local_mtime = long(os.stat(self.pkg_path).st_mtime) + local_mtime = os.stat(self.pkg_path)[stat.ST_MTIME] except OSError: pass else: diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index d14b6c3a1..1d7fdc686 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -2566,7 +2566,7 @@ def git_sync_timestamps(settings, portdir): if ec in updated_ec_mtimes: continue ec_path = os.path.join(ec_dir, ec + ".eclass") - current_mtime = long(os.stat(ec_path).st_mtime) + current_mtime = os.stat(ec_path)[stat.ST_MTIME] if current_mtime != ec_mtime: os.utime(ec_path, (ec_mtime, ec_mtime)) updated_ec_mtimes[ec] = ec_mtime diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index f1da3bd5f..98b8478a8 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -6,6 +6,7 @@ from __future__ import print_function import logging import signal +import stat import sys import textwrap import platform @@ -106,7 +107,7 @@ def chk_updated_info_files(root, infodirs, prev_mtimes, retval): continue inforoot=normpath(root+z) if os.path.isdir(inforoot): - infomtime = long(os.stat(inforoot).st_mtime) + infomtime = os.stat(inforoot)[stat.ST_MTIME] if inforoot not in prev_mtimes or \ prev_mtimes[inforoot] != infomtime: regen_infodirs.append(inforoot) @@ -196,7 +197,7 @@ def chk_updated_info_files(root, infodirs, prev_mtimes, retval): del e #update mtime so we can potentially avoid regenerating. - prev_mtimes[inforoot] = long(os.stat(inforoot).st_mtime) + prev_mtimes[inforoot] = os.stat(inforoot)[stat.ST_MTIME] if badcount: out.eerror("Processed %d info files; %d errors." % \ -- cgit v1.2.3-1-g7c22