Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1980f76

Browse files
committed
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.
1 parent e83b063 commit 1980f76

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

etc/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.PHONY: json-to-xml clean
2+
3+
CONVERT = ./json2xml.py
4+
5+
API_JSON_FILES = $(shell find . -type f -name '*-api.json')
6+
API_XML_FILES = $(patsubst %.json,%.xml,$(API_JSON_FILES))
7+
8+
help:
9+
$(info Valid targets are:)
10+
$(info json-to-xml - convert json API files to xml for consumption by GSL)
11+
12+
json-to-xml: $(API_XML_FILES)
13+
14+
%.xml: %.json
15+
$(CONVERT) --pretty -o $@ < $<
16+
17+
clean:
18+
-rm $(API_XML_FILES)
19+

etc/json2xml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def main():
275275

276276
if (options.out):
277277
file = open(options.out, 'wb')
278-
file.write(out)
278+
file.write(out.encode('utf-8'))
279279
file.close()
280280
else:
281281
print(out.encode('utf-8'))

0 commit comments

Comments
 (0)