diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index 8e8da7c7962bf36fdc83973be38c9bd4a17ac89e..035a28acb2aa7f8ddf763af0299f314e40897b5d 100644 --- a/scripts/qapi-commands.py +++ b/scripts/qapi-commands.py @@ -1,16 +1,17 @@ -# -# QAPI command marshaller 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 command marshaller 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 * @@ -255,18 +256,11 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor): (input_file, output_dir, do_c, do_h, prefix, opts) = parse_command_line() -blurb = ''' - * Schema-defined QAPI/QMP commands - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori -''' +blurb = ' * Schema-defined QAPI/QMP commands' (fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix, 'qmp-marshal.c', 'qmp-commands.h', - blurb) + blurb, __doc__) fdef.write(mcgen(''' diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py index 2b7d720c08fe55709602189329473c2ccbd32891..91874d84fbdc7b2aea134128c6c1931ce8b31ac9 100644 --- a/scripts/qapi-event.py +++ b/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 * @@ -171,18 +172,11 @@ 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/osdep.h" diff --git a/scripts/qapi-introspect.py b/scripts/qapi-introspect.py index 83da2bdb942b7a9daa421f6859cd0ba8d33ecb44..cc1c3cb703244e29c495b569b36f6d20db89d96d 100644 --- a/scripts/qapi-introspect.py +++ b/scripts/qapi-introspect.py @@ -1,13 +1,14 @@ -# -# QAPI introspection generator -# -# Copyright (C) 2015-2016 Red Hat, Inc. -# -# Authors: -# 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 introspection generator + +Copyright (C) 2015-2018 Red Hat, Inc. + +Authors: + 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 * @@ -176,15 +177,11 @@ for o, a in opts: if o in ('-u', '--unmask-non-abi-names'): opt_unmask = True -blurb = ''' - * QAPI/QMP schema introspection - * - * Copyright (C) 2015 Red Hat, Inc. -''' +blurb = ' * QAPI/QMP schema introspection' (fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix, 'qmp-introspect.c', 'qmp-introspect.h', - blurb) + blurb, __doc__) fdef.write(mcgen(''' #include "qemu/osdep.h" diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 86afc57f92358d7872497949985695d42966e77c..766c7737d84998551cde7a98c7cb1a4f1d950dcb 100644 --- a/scripts/qapi-types.py +++ b/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/scripts/qapi-visit.py b/scripts/qapi-visit.py index 0a367072fbc6ebfb12c115f48e954557e3a9310c..269227a38e0cb28049ac05d254920dde8dd527a0 100644 --- a/scripts/qapi-visit.py +++ b/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/scripts/qapi.py b/scripts/qapi.py index 2e5a1ce6a8fe18e99c3c7c44fdb61afafd6178e5..d2695cd8d6095cf16a607517ba732e4232b648ef 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -1985,21 +1985,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: