projects
/
naja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git://ctpug.org.za/naja
[naja.git]
/
tools
/
gen_json.py
diff --git
a/tools/gen_json.py
b/tools/gen_json.py
index 6ae4b514c3302f29d4dddedc728153b355954193..bec7ffc2b1228627e02912ad8b00cdb3cb153ee2 100755
(executable)
--- a/
tools/gen_json.py
+++ b/
tools/gen_json.py
@@
-3,10
+3,8
@@
import json
import os
import json
import os
-import yaml
-
-def main():
+def main(update=True):
data = os.path.join(os.path.dirname(__file__), '..', 'data')
deck_dir = os.path.join(data, 'location_decks')
data = os.path.join(os.path.dirname(__file__), '..', 'data')
deck_dir = os.path.join(data, 'location_decks')
@@
-19,6
+17,10
@@
def main():
yaml_path = os.path.join(deck_dir, yaml_fn)
json_path = os.path.join(deck_dir, json_fn)
yaml_path = os.path.join(deck_dir, yaml_fn)
json_path = os.path.join(deck_dir, json_fn)
+ if not update and os.path.exists(json_path):
+ continue
+
+ import yaml
with open(yaml_path) as yaml_f:
obj = yaml.safe_load(yaml_f)
with open(json_path, 'w') as json_f:
with open(yaml_path) as yaml_f:
obj = yaml.safe_load(yaml_f)
with open(json_path, 'w') as json_f: