X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Ftools%2Fvppapigen%2Fvppapigen.py;h=0779e80b7cba41d92f74f7f6d2f7fa2e9a139a48;hb=cc134719b7cb8a0a9df76ef0d8f4343295b9d55a;hp=a1bb0e184df7f4b500629cdc8df0dfd8410f131e;hpb=fc70e3a89f7a5a8913eac3d89ace578f9d1a7c11;p=vpp.git diff --git a/src/tools/vppapigen/vppapigen.py b/src/tools/vppapigen/vppapigen.py index a1bb0e184df..0779e80b7cb 100755 --- a/src/tools/vppapigen/vppapigen.py +++ b/src/tools/vppapigen/vppapigen.py @@ -9,6 +9,9 @@ import logging import binascii import os +# Ensure we don't leave temporary files around +sys.dont_write_bytecode = True + # # VPP API language # @@ -527,7 +530,7 @@ class VPPAPI(object): def __init__(self, debug=False, filename='', logger=None): self.lexer = lex.lex(module=VPPAPILexer(filename), debug=debug) self.parser = yacc.yacc(module=VPPAPIParser(filename, logger), - tabmodule='vppapigentab', debug=debug) + write_tables=False, debug=debug) self.logger = logger def parse_string(self, code, debug=0, lineno=1): @@ -574,6 +577,7 @@ class VPPAPI(object): msgs = {d.name: d for d in s['defines']} svcs = {s.caller: s for s in s['services']} + replies = {s.reply: s for s in s['services']} seen_services = {} for service in svcs: @@ -584,6 +588,9 @@ class VPPAPI(object): raise ValueError('Service definition refers to unknown message' ' definition in reply: {}' .format(svcs[service].reply)) + if service in replies: + raise ValueError('Service definition refers to message' + ' marked as reply: {}'.format(service)) for event in svcs[service].events: if event not in msgs: raise ValueError('Service definition refers to unknown ' @@ -597,16 +604,12 @@ class VPPAPI(object): continue if msgs[d].singular is True: continue - #if d.endswith('_counters'): - # continue - #if d.endswith('_event'): - # continue if d.endswith('_reply'): if d[:-6] in svcs: continue if d[:-6] not in msgs: - self.logger.warning('{} missing calling message' - .format(d)) + raise ValueError('{} missing calling message' + .format(d)) continue if d.endswith('_dump'): if d in svcs: @@ -615,14 +618,14 @@ class VPPAPI(object): s['services'].append(Service(d, d[:-5]+'_details', stream=True)) else: - self.logger.error('{} missing details message' - .format(d)) + raise ValueError('{} missing details message' + .format(d)) continue if d.endswith('_details'): if d[:-8]+'_dump' not in msgs: - self.logger.error('{} missing dump message' - .format(d)) + raise ValueError('{} missing dump message' + .format(d)) continue if d in svcs: @@ -630,9 +633,8 @@ class VPPAPI(object): if d+'_reply' in msgs: s['services'].append(Service(d, d+'_reply')) else: - self.logger.warning('{} missing reply message ({})' - .format(d, d+'_reply')) - s['services'].append(Service(d, None)) + raise ValueError('{} missing reply message ({}) or service definition' + .format(d, d+'_reply')) return s