[game-data-packager] 02/11: yaml2json: restore its original functionality

Simon McVittie smcv at debian.org
Wed Jan 13 00:06:50 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit 15bc99c7b18343b3a7633e15d1d84a7b210d5a21
Author: Simon McVittie <smcv at debian.org>
Date:   Sun Jan 10 14:34:19 2016 +0000

    yaml2json: restore its original functionality
---
 tools/yaml2json.py | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tools/yaml2json.py b/tools/yaml2json.py
new file mode 100755
index 0000000..5faa1ea
--- /dev/null
+++ b/tools/yaml2json.py
@@ -0,0 +1,31 @@
+#!/usr/bin/python3
+# encoding=utf-8
+#
+# Copyright © 2015 Simon McVittie <smcv at debian.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# You can find the GPL license text on a Debian system under
+# /usr/share/common-licenses/GPL-2.
+
+import json
+import os
+import sys
+
+import yaml
+
+def main(f, out):
+    data = yaml.load(open(f, encoding='utf-8'), Loader=yaml.CSafeLoader)
+    json.dump(data, open(out + '.tmp', 'w', encoding='utf-8'), sort_keys=True)
+    os.rename(out + '.tmp', out)
+
+if __name__ == '__main__':
+    main(sys.argv[1], sys.argv[2])
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list