parametrized/dynamic task-creators?

Skip to first unread message

Svilen Dobrev

Nov 15, 2021, 2:49:45 PM11/15/21
to python-doit
i am coming from heavy make usage.. and cannot find a way to dynamicaly create tasks.
Say (artificial example), there are many .mp3 files. 
i want to convert them to .wav ; and then each .wav to .flac

Makefile would be: 
%.wav: %.mp3
   convert-mp3-to-wav $< $@
%.flac: %.wav
   convert-wav-to-flac $< $@

MP3s = $(wildcard *.mp3)
FLACs = $(MP3s:%.mp3=%.flac)
now: $(FLACs)

i know how to make top level task_mp3towav() task generator in doit, but how to generate the other levels? their in-dependencies are not known before hand, the top-level is the one that pulls the whole graph.
e.g. some generative? task_wav2flac() that takes *any* .wav and makes it into .flac ; and then execute those depending on what is needed by the top-level (or any other level) ones.


Reply all
Reply to author
0 new messages