@@ -133,69 +133,76 @@ def main():
133
133
'meta' : {},
134
134
'ref' : {}
135
135
}
136
+
137
+ try :
136
138
137
- for section in configParser .sections ():
138
- input ['configs' ].append ({
139
- 'name' : section ,
140
- 'namespace' : configParser .get (section ,'namespace' ),
141
- 'tags' : {'$' + key : configParser .get (section ,key ) for key in configParser .get (section ,'tags' ).split ("," )},
142
- })
139
+ for section in configParser .sections ():
140
+ input ['configs' ].append ({
141
+ 'name' : section ,
142
+ 'namespace' : configParser .get (section ,'namespace' ),
143
+ 'tags' : {'$' + key : configParser .get (section ,key ) for key in configParser .get (section ,'tags' ).split ("," )},
144
+ })
145
+
146
+ # phase 2: parse specs
147
+ for config in input ['configs' ]:
148
+ specs , input ['meta' ], input ['ref' ] = parse_specs .parse (config ['name' ], args ['ver' ], config ['tags' ], input ['meta' ], input ['ref' ])
149
+ input ['specs' ].append (specs )
150
+
151
+ util .jsonWrite (args ['api_json' ], input )
143
152
144
- # phase 2: parse specs
145
- for config in input ['configs' ]:
146
- specs , input ['meta' ], input ['ref' ] = parse_specs .parse (config ['name' ], args ['ver' ], config ['tags' ], input ['meta' ], input ['ref' ])
147
- input ['specs' ].append (specs )
153
+ # phase 3: generate files
154
+ if args ['clean' ]:
155
+ clean ()
148
156
149
- util .jsonWrite (args ['api_json' ], input )
157
+ incpath = os .path .join ("../include/" )
158
+ srcpath = os .path .join ("../source/" )
159
+ docpath = os .path .join ("../docs/" )
150
160
151
- # phase 3: generate files
152
- if args ['clean' ]:
153
- clean ()
161
+ generate_docs .prepare (docpath , args ['rst' ], args ['html' ], args ['ver' ])
162
+ generate_docs .generate_ref (docpath , input ['ref' ])
154
163
155
- incpath = os . path . join ( "../include/" )
156
- srcpath = os . path . join ( "../source/" )
157
- docpath = os . path . join ( "../docs/" )
164
+ for idx , specs in enumerate ( input [ 'specs' ]):
165
+ config = input [ 'configs' ][ idx ]
166
+ if args [ config [ 'name' ]]:
158
167
159
- generate_docs .prepare (docpath , args ['rst' ], args ['html' ], args ['ver' ])
160
- generate_docs .generate_ref (docpath , input ['ref' ])
168
+ generate_code .generate_api (incpath , srcpath , config ['namespace' ], config ['tags' ], args ['ver' ], args ['rev' ], specs , input ['meta' ])
161
169
162
- for idx , specs in enumerate (input ['specs' ]):
163
- config = input ['configs' ][idx ]
164
- if args [config ['name' ]]:
170
+ if args ['rst' ]:
171
+ generate_docs .generate_rst (docpath , config ['name' ], config ['namespace' ], config ['tags' ], args ['ver' ], args ['rev' ], specs , input ['meta' ])
165
172
166
- generate_code .generate_api (incpath , srcpath , config ['namespace' ], config ['tags' ], args ['ver' ], args ['rev' ], specs , input ['meta' ])
173
+ if util .makeErrorCount ():
174
+ print ("\n %s Errors found during generation, stopping execution!" % util .makeErrorCount ())
175
+ return
167
176
168
- if args ['rst ' ]:
169
- generate_docs . generate_rst ( docpath , config [ 'name' ], config [ 'namespace' ], config [ 'tags' ], args [ 'ver' ], args [ 'rev' ], specs , input [ 'meta' ] )
177
+ if args ['debug ' ]:
178
+ util . makoFileListWrite ( "generated.json" )
170
179
171
- if util .makeErrorCount ():
172
- print ("\n %s Errors found during generation, stopping execution!" % util .makeErrorCount ())
173
- return
180
+ # phase 4: build code
181
+ if args ['build' ]:
182
+ if not build ():
183
+ print ("\n Build failed, stopping execution!" )
184
+ return
174
185
175
- if args ['debug' ]:
176
- util .makoFileListWrite ("generated.json" )
186
+ # phase 5: prep for publication of html or pdf
187
+ if args ['html' ] or args ['pdf' ]:
188
+ generate_docs .generate_common (docpath , configParser .sections (), args ['ver' ], args ['rev' ])
177
189
178
- # phase 4: build code
179
- if args ['build' ]:
180
- if not build ():
181
- print ("\n Build failed, stopping execution!" )
182
- return
190
+ # phase 5: publish documentation
191
+ if args ['html' ]:
192
+ generate_docs .generate_html (docpath )
183
193
184
- # phase 5: prep for publication of html or pdf
185
- if args ['html' ] or args ['pdf' ]:
186
- generate_docs .generate_common (docpath , configParser .sections (), args ['ver' ], args ['rev' ])
194
+ if args ['pdf' ]:
195
+ generate_docs .generate_pdf (docpath )
187
196
188
- # phase 5: publish documentation
189
- if args ['html' ]:
190
- generate_docs .generate_html (docpath )
197
+ if args ['update_spec' ]:
198
+ update_spec (args ['update_spec' ])
191
199
192
- if args ['pdf' ]:
193
- generate_docs .generate_pdf (docpath )
200
+ print ("\n Completed in %.1f seconds!" % (time .time () - start ))
194
201
195
- if args ['update_spec' ]:
196
- update_spec (args ['update_spec' ])
202
+ except :
203
+ print ("Failed to generate specification." )
204
+ return sys .exit (1 )
197
205
198
- print ("\n Completed in %.1f seconds!" % (time .time () - start ))
199
206
200
207
if __name__ == '__main__' :
201
208
main ()
0 commit comments