[reprotest] 01/01: More pythonic way to get file mtimes
Ximin Luo
infinity0 at debian.org
Thu Dec 8 15:26:16 UTC 2016
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository reprotest.
commit e9378813070db54356fe5bbea05d610fd4430a56
Author: Ximin Luo <infinity0 at debian.org>
Date: Thu Dec 8 16:24:23 2016 +0100
More pythonic way to get file mtimes
---
reprotest/__init__.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/reprotest/__init__.py b/reprotest/__init__.py
index 213c7df..4972d08 100644
--- a/reprotest/__init__.py
+++ b/reprotest/__init__.py
@@ -13,6 +13,7 @@ import shutil
import subprocess
import sys
import tempfile
+import time
import traceback
import types
@@ -313,8 +314,8 @@ def faketime(script, env, tree, source_root):
# This tries hard to avoid bad interactions with faketime and make(1) etc.
# However if you're building this too soon after changing one of the source
# files then the effect of this variation is not very great.
- shellstr = "find {0} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -b1-10".format(shlex.quote(source_root))
- t = int(subprocess.check_output(shellstr, shell=True).rstrip() or time.time())
+ filemtimes = (os.path.getmtime(os.path.join(root, f)) for root, dirs, files in os.walk(source_root) for f in files)
+ t = int(max(filemtimes, default=time.time()))
settime = _shell_ast.SimpleCommand.make('faketime', '@%s'%t)
new_experiment = script.experiment.append_command(settime)
return Pair(script.control, new_experiment), env, tree
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/reprotest.git
More information about the Reproducible-commits
mailing list