minor cleanup to be more verbose when there are errors; most of the time when we...
[plcapi.git] / doc / DocBookLocal.py
1 #!/usr/bin/env python
2
3 from PLC.API import PLCAPI
4 from PLC.Faults import PLCInvalidAPIMethod
5 from DocBook import DocBook
6 import sys
7
8 api = PLCAPI(None)
9 methods = api.all_methods
10 good_apis = []
11 bad_apis = []
12 for method in methods:
13     try:
14         good_api = api.callable(method)
15         good_apis.append(good_api)
16     except PLCInvalidAPIMethod, e:
17         bad_apis.append((method,e))
18
19 DocBook(good_apis).Process()
20
21 if len(bad_apis):
22     sys.stderr.write("UNEXPECTED: There are %d non-callable methods:\n")
23     for bad_api,e in bad_apis:
24         sys.stderr.write("\t%s:%s\n" % (bad_api,e))
25     sys.exit(-1)