summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2019-09-28 14:03:20 +0200
committerNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2019-09-28 14:03:20 +0200
commitf3d63966b944735d2926b0a2d5bd54aff90c1e20 (patch)
tree588c383da5aeae6b64ed1cbfe7883e1aa284be26
parent252568121742f336a9e42e55a8985e5e7c31f49f (diff)
* refactor dofiles in python
-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())