|
@@ -0,0 +1,26 @@
|
|
1
|
+#-*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+import sys
|
|
4
|
+import admin
|
|
5
|
+
|
|
6
|
+def usage():
|
|
7
|
+ print("""Usage : %s em_filename [output_filename] [translator]
|
|
8
|
+
|
|
9
|
+ em_filename \tThe file where the editorial model is stored
|
|
10
|
+ output_filename \tThe file where we should write the dynamic leapi code. If - print to stdout
|
|
11
|
+ translator \t\tThe translator to use to read the editorial model file em_filename
|
|
12
|
+""" % sys.argv[0])
|
|
13
|
+
|
|
14
|
+if __name__ == '__main__':
|
|
15
|
+ if len(sys.argv) < 2 or len(sys.argv) > 4:
|
|
16
|
+ usage()
|
|
17
|
+ exit(1)
|
|
18
|
+ filename = sys.argv[1]
|
|
19
|
+ output_file = 'lodel/leapi/dyncode.py' if len(sys.argv) < 3 else sys.argv[2]
|
|
20
|
+ translator = 'picklefile' if len(sys.argv) < 4 else sys.argv[3]
|
|
21
|
+
|
|
22
|
+ if output_file == '-':
|
|
23
|
+ print(admin.generate_dyncode(filename, translator))
|
|
24
|
+ else:
|
|
25
|
+ admin.refresh_dyncode(filename, translator, output_file)
|
|
26
|
+
|