apibuild: Introduce app class

All top-level functions have been moved to this class.

On top of that, the app.warning() method has been defined,
so that calls to it - already present in rebuild() - can
actually succeed.
This commit is contained in:
Andrea Bolognani 2016-04-25 14:26:50 +02:00
parent ccaceab7bd
commit 4a98ebb07c

View File

@ -2584,7 +2584,13 @@ class docBuilder:
output.close()
def rebuild(name):
class app:
def warning(self, msg):
global warnings
warnings = warnings + 1
print msg
def rebuild(self, name):
if name not in ["libvirt", "libvirt-qemu", "libvirt-lxc", "libvirt-admin"]:
self.warning("rebuild() failed, unknown module %s") % name
return None
@ -2618,23 +2624,25 @@ def rebuild(name):
builder.serialize()
return builder
#
# for debugging the parser
#
def parse(filename):
#
# for debugging the parser
#
def parse(self, filename):
parser = CParser(filename)
idx = parser.parse()
return idx
if __name__ == "__main__":
app = app()
if len(sys.argv) > 1:
debug = 1
parse(sys.argv[1])
app.parse(sys.argv[1])
else:
rebuild("libvirt")
rebuild("libvirt-qemu")
rebuild("libvirt-lxc")
rebuild("libvirt-admin")
app.rebuild("libvirt")
app.rebuild("libvirt-qemu")
app.rebuild("libvirt-lxc")
app.rebuild("libvirt-admin")
if warnings > 0:
sys.exit(2)
else: