aboutsummaryrefslogtreecommitdiff
path: root/src/ee/fact/doit.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-07-14 15:00:49 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-07-14 15:00:49 +0200
commit68b2f9bd888f86766fea254d6253f3b1e88cc8a4 (patch)
tree5103abc40c4e0b309588179d2b0f3720ddfc8e66 /src/ee/fact/doit.py
parentc5476aba69eded6ccc1343247219ea754e08e3ff (diff)
downloadee-python-68b2f9bd888f86766fea254d6253f3b1e88cc8a4.tar.gz
ee-python-68b2f9bd888f86766fea254d6253f3b1e88cc8a4.tar.bz2
ee-python-68b2f9bd888f86766fea254d6253f3b1e88cc8a4.tar.xz
ee-python-68b2f9bd888f86766fea254d6253f3b1e88cc8a4.zip
wip
Diffstat (limited to 'src/ee/fact/doit.py')
-rw-r--r--src/ee/fact/doit.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ee/fact/doit.py b/src/ee/fact/doit.py
new file mode 100644
index 0000000..f922cf1
--- /dev/null
+++ b/src/ee/fact/doit.py
@@ -0,0 +1,14 @@
+
+
+def uptodate_if_isdir(path):
+ def do_check():
+ return os.path.isdir(path)
+ return do_check
+
+def uptodate_if_older_than(dependency, *targets):
+ def do_check():
+ dep_mtime = os.stat(dependency).st_mtime
+ mtimes = [os.stat(t).st_mtime for t in targets if os.path.isfile(t)]
+ target_mtime = max(mtimes) if mtimes else 0
+ return dep_mtime < target_mtime
+ return do_check