summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dofile-in-python/all.do7
-rw-r--r--dofile-in-python/target.do6
2 files changed, 10 insertions, 3 deletions
diff --git a/dofile-in-python/all.do b/dofile-in-python/all.do
index f236774..fb14f11 100644
--- a/dofile-in-python/all.do
+++ b/dofile-in-python/all.do
@@ -2,10 +2,13 @@
from subprocess import run
from time import sleep
+def redo_ifchange(dependency):
+ run(['redo-ifchange', dependency])
+
with open('source', 'w') as f:
f.write('foo')
-run(['redo-ifchange', 'target'])
+redo_ifchange('target')
with open('target', 'r') as f:
target_contents_1 = f.read()
@@ -15,7 +18,7 @@ sleep(1)
with open('source', 'w') as f:
f.write('bar')
-run(['redo-ifchange', 'target'])
+redo_ifchange('target')
with open('target', 'r') as f:
target_contents_2 = f.read()
diff --git a/dofile-in-python/target.do b/dofile-in-python/target.do
index 5f0fadb..6897f80 100644
--- a/dofile-in-python/target.do
+++ b/dofile-in-python/target.do
@@ -2,5 +2,9 @@
from subprocess import run
from datetime import datetime
-run(['redo-ifchange', 'source'])
+def redo_ifchange(dependency):
+ run(['redo-ifchange', dependency])
+
+redo_ifchange('source')
+
print(datetime.now().timestamp())