diff --git a/Makefile b/Makefile index 507d7139457..94ed3ba6c96 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,7 @@ API_SHARED_INFO = ./etc/api/shared.yaml API_JSON_FILES = $(shell find ./etc -type f -name '*-api.json') help: - $(info Programs) - $(info ----> templat engine: '$(TPL)') + $(info using template engine: '$(TPL)') $(info ) $(info Targets) $(info help - print this help) @@ -30,13 +29,13 @@ $(PYTHON): $(MAKO_RENDER): $(PYTHON) $(API_DEPS): $(API_SHARED_INFO) $(API_DEPS_TPL) $(MAKO_RENDER) - $(TPL) --data-files $(API_SHARED_INFO) $(API_DEPS_TPL) > $@ + $(TPL) --data-files $(API_SHARED_INFO) --var SHARED_INFO_FILE=$(API_SHARED_INFO) $(API_DEPS_TPL) > $@ api-deps: $(API_DEPS) include $(API_DEPS) -clean: +clean: clean-api -rm -Rf $(VENV_DIR) -rm $(API_DEPS) diff --git a/etc/bin/mako-render b/etc/bin/mako-render index a8873f38e14..bcb82a1ce49 100644 --- a/etc/bin/mako-render +++ b/etc/bin/mako-render @@ -293,7 +293,7 @@ def cmdline(argv=None): data = load_data(datafiles) data = dict((k, DictObject(v)) for k, v in data.items()) data.update(dict([varsplit(var) for var in options.var])) - + try: print(template.render(**data)) except: diff --git a/etc/sublime-text/youtube-rs.sublime-project b/etc/sublime-text/youtube-rs.sublime-project index 07659be8e56..5e6e94b2645 100644 --- a/etc/sublime-text/youtube-rs.sublime-project +++ b/etc/sublime-text/youtube-rs.sublime-project @@ -10,6 +10,7 @@ "folder_exclude_patterns" : [ "target", ".git", + ".pyenv" ], }, ] diff --git a/src/mako/deps.mako b/src/mako/deps.mako index e69de29bb2d..6caac48c682 100644 --- a/src/mako/deps.mako +++ b/src/mako/deps.mako @@ -0,0 +1,24 @@ +<%api_info=[]%> +% for a in api.list: +<% + gen_root = directories.output + '/' + a.name + '_' + a.version + api_name = a.name + a.version + api_clean = api_name + '-clean' + api_info.append((api_name, api_clean, gen_root)) +%> +${gen_root}: ${directories.api_base}/${a.name}/${a.version}/${a.name}-api.json ${SHARED_INFO_FILE} +${api_name}: ${gen_root} + @echo TODO ${api_name} command +${api_clean}: + -rm -Rf ${gen_root} +% endfor + +.PHONY += $(.PHONY) ${' '.join(a[0] for a in api_info)} ${' '.join(a[1] for a in api_info)} + +help-api: +% for a in api_info: + $(info ${a[0]} - build the ${a[0]} api) + $(info ${a[1]} - clean all generated files of the ${a[0]} api) +% endfor + +clean-api: ${' '.join(a[1] for a in api_info)} \ No newline at end of file