diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2018-08-20 23:28:00 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2018-08-20 23:28:00 +0200 |
commit | ec429f152cf1d32a86f5783ed87453b42f7ef190 (patch) | |
tree | e872b07b9c59fc911dff06c0fe9abcc69f763405 /dodo.py | |
parent | 61bbddad93ada8f877c26b8d748c8326085d3e3a (diff) | |
download | semantic-sandbox-master.tar.gz semantic-sandbox-master.tar.bz2 semantic-sandbox-master.tar.xz semantic-sandbox-master.zip |
Diffstat (limited to 'dodo.py')
-rw-r--r-- | dodo.py | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -0,0 +1,43 @@ +import glob +import shutil +from collections import namedtuple +from pathlib import Path +import stm32 + +File = namedtuple("File", "xlsx, csv, owl") + +files = [File(Path(xlsx), Path("stm32/csv/{}.csv".format(xlsx[6:-5])), Path("stm32/owl/{}.owl".format(xlsx[6:-5]))) + for xlsx in list(glob.glob("stm32/*.xlsx"))] + +def make_parent(path): + d = path.parent + if not d.is_dir(): + d.mkdir() + +def task_stm32_csv(): + def action(xlsx, csv): + # print("xlsx={}, csv={}".format(xlsx, csv)) + make_parent(csv) + stm32.xlsx_to_csv(xlsx, csv) + + for f in files: + yield dict( + name=f.csv, + actions=[(action, [f.xlsx, f.csv])], + file_dep=[f.xlsx], + targets=[f.csv], + clean=True) + +def task_stm32_owl(): + def action(csv, owl): + # print("csv={}, owl={}".format(csv, owl)) + make_parent(owl) + stm32.csv_to_owl(csv, owl) + + for f in files: + yield dict( + name=f.owl, + actions=[(action, [f.csv, f.owl])], + file_dep=[f.csv], + targets=[f.owl], + clean=True) |