From 1980f76c3240b44c306158df30793ca20ffc9461 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 1 Mar 2015 09:24:16 +0100 Subject: [PATCH] feat(make): makefile for handling json-to-xml That way, it will remain clearly documented how to do this, and allow for efficient calling of gsl as well, at some point. Of course it will be a little more difficult for us to know all dependencies, but gsl could generate these as well for us, I suppose. --- etc/Makefile | 19 +++++++++++++++++++ etc/json2xml.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 etc/Makefile diff --git a/etc/Makefile b/etc/Makefile new file mode 100644 index 0000000000..9841785ca9 --- /dev/null +++ b/etc/Makefile @@ -0,0 +1,19 @@ +.PHONY: json-to-xml clean + +CONVERT = ./json2xml.py + +API_JSON_FILES = $(shell find . -type f -name '*-api.json') +API_XML_FILES = $(patsubst %.json,%.xml,$(API_JSON_FILES)) + +help: + $(info Valid targets are:) + $(info json-to-xml - convert json API files to xml for consumption by GSL) + +json-to-xml: $(API_XML_FILES) + +%.xml: %.json + $(CONVERT) --pretty -o $@ < $< + +clean: + -rm $(API_XML_FILES) + diff --git a/etc/json2xml.py b/etc/json2xml.py index b3e88ef1da..324b8e4f9c 100755 --- a/etc/json2xml.py +++ b/etc/json2xml.py @@ -275,7 +275,7 @@ def main(): if (options.out): file = open(options.out, 'wb') - file.write(out) + file.write(out.encode('utf-8')) file.close() else: print(out.encode('utf-8'))