-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdodo.py
41 lines (35 loc) · 1.03 KB
/
dodo.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import glob
from pathlib import Path
import subprocess
import re
import os
env = os.environ.copy()
files = glob.glob("*.cpp")
mm_regex = re.compile(r'([\w\/]+\.h)')
def determine_deps(file):
mm = subprocess.check_output(['g++', '-MM', file, '-Iother_includes'], env=env).decode('utf-8')
ret = mm_regex.findall(mm)
print("getting deps for " + file)
return { 'file_dep': ret }
def task_determine_dependencies():
for file in files:
yield {
'name': file,
'actions': [(determine_deps, [file])],
'file_dep': [file]
}
def task_compile():
"""I'm gonna try and compile stuff hot stuff"""
yield {
'basename': 'compile_x',
'name': None,
'doc': 'builds file x'
}
for file in files:
yield {
'name' : file,
'actions' : [f"g++ -c {file} -Iother_includes"],
'file_dep': [file],
'calc_dep': ["determine_dependencies:" + file],
'targets' : [Path(file).with_suffix('.o')]
}