diff --git a/qemu/scripts/qapi-event.py b/qemu/scripts/qapi-event.py index 467bdef4..2c22117a 100644 --- a/qemu/scripts/qapi-event.py +++ b/qemu/scripts/qapi-event.py @@ -1,15 +1,16 @@ -# -# QAPI event generator -# -# Copyright (c) 2014 Wenchao Xia -# Copyright (c) 2015-2016 Red Hat Inc. -# -# Authors: -# Wenchao Xia -# Markus Armbruster -# -# This work is licensed under the terms of the GNU GPL, version 2. -# See the COPYING file in the top-level directory. +""" +QAPI event generator + +Copyright (c) 2014 Wenchao Xia +Copyright (c) 2015-2018 Red Hat Inc. + +Authors: + Wenchao Xia + Markus Armbruster + +This work is licensed under the terms of the GNU GPL, version 2. +See the COPYING file in the top-level directory. +""" from qapi import * @@ -170,19 +171,12 @@ class QAPISchemaGenEventVisitor(QAPISchemaVisitor): (input_file, output_dir, do_c, do_h, prefix, dummy) = parse_command_line() -blurb = ''' - * Schema-defined QAPI/QMP events - * - * Copyright (c) 2014 Wenchao Xia - * - * Authors: - * Wenchao Xia - */ -''' +blurb = ' * Schema-defined QAPI/QMP events' (fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix, 'qapi-event.c', 'qapi-event.h', - blurb) + blurb, __doc__) + fdef.write(mcgen(''' #include "qemu-common.h" #include "%(prefix)sqapi-event.h" diff --git a/qemu/scripts/qapi-types.py b/qemu/scripts/qapi-types.py index 2b3fc4a1..9f6fc534 100644 --- a/qemu/scripts/qapi-types.py +++ b/qemu/scripts/qapi-types.py @@ -1,15 +1,17 @@ -# -# QAPI types generator -# -# Copyright IBM, Corp. 2011 -# Copyright (c) 2013-2016 Red Hat Inc. -# -# Authors: -# Anthony Liguori -# Markus Armbruster -# -# This work is licensed under the terms of the GNU GPL, version 2. +""" +QAPI types generator + +Copyright IBM, Corp. 2011 +Copyright (c) 2013-2018 Red Hat Inc. + +Authors: + Anthony Liguori + Michael Roth + Markus Armbruster + +This work is licensed under the terms of the GNU GPL, version 2. # See the COPYING file in the top-level directory. +""" from qapi import * @@ -250,19 +252,11 @@ for o, a in opts: if o in ('-b', '--builtins'): do_builtins = True -blurb = ''' - * Schema-defined QAPI types - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * Michael Roth -''' +blurb = ' * Schema-defined QAPI types' (fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix, 'qapi-types.c', 'qapi-types.h', - blurb) + blurb, __doc__) fdef.write(mcgen(''' #include "qemu/osdep.h" diff --git a/qemu/scripts/qapi-visit.py b/qemu/scripts/qapi-visit.py index e6e647c4..f07b285e 100644 --- a/qemu/scripts/qapi-visit.py +++ b/qemu/scripts/qapi-visit.py @@ -1,16 +1,17 @@ -# -# QAPI visitor generator -# -# Copyright IBM, Corp. 2011 -# Copyright (C) 2014-2016 Red Hat, Inc. -# -# Authors: -# Anthony Liguori -# Michael Roth -# Markus Armbruster -# -# This work is licensed under the terms of the GNU GPL, version 2. -# See the COPYING file in the top-level directory. +""" +QAPI visitor generator + +Copyright IBM, Corp. 2011 +Copyright (C) 2014-2018 Red Hat, Inc. + +Authors: + Anthony Liguori + Michael Roth + Markus Armbruster + +This work is licensed under the terms of the GNU GPL, version 2. +See the COPYING file in the top-level directory. +""" from qapi import * @@ -334,18 +335,11 @@ for o, a in opts: if o in ('-b', '--builtins'): do_builtins = True -blurb = ''' - * Schema-defined QAPI visitors - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori -''' +blurb = ' * Schema-defined QAPI visitors' (fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix, 'qapi-visit.c', 'qapi-visit.h', - blurb) + blurb, __doc__) fdef.write(mcgen(''' #include "qemu/osdep.h" diff --git a/qemu/scripts/qapi.py b/qemu/scripts/qapi.py index 7d1bb322..72aa293c 100644 --- a/qemu/scripts/qapi.py +++ b/qemu/scripts/qapi.py @@ -1990,21 +1990,24 @@ def parse_command_line(extra_options='', extra_long_options=[]): # -def open_output(output_dir, do_c, do_h, prefix, c_file, h_file, blurb): +def open_output(output_dir, do_c, do_h, prefix, c_file, h_file, blurb, doc): guard = guardname(prefix + h_file) c_file = output_dir + prefix + c_file h_file = output_dir + prefix + h_file + copyright = '\n * '.join(re.findall(r'^Copyright .*', doc, re.MULTILINE)) comment = mcgen('''/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ /* %(blurb)s + * + * %(copyright)s * * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ ''', - blurb=blurb.strip('\n')) + blurb=blurb, copyright=copyright) if output_dir: try: