summaryrefslogtreecommitdiff
path: root/dofile-in-python/all.do
blob: fb14f111f2aeb145897d854f0904438ac535f366 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3.5
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')

redo_ifchange('target')

with open('target', 'r') as f:
    target_contents_1 = f.read()

sleep(1)

with open('source', 'w') as f:
    f.write('bar')

redo_ifchange('target')

with open('target', 'r') as f:
    target_contents_2 = f.read()

if target_contents_1 == target_contents_2:
    exit(1)