[glib] gdbus-codegen: Split license string
- From: Iñigo Martínez <inigomartinez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gdbus-codegen: Split license string
- Date: Tue, 9 Jan 2018 12:13:35 +0000 (UTC)
commit a3d223d0e9f68e85029346024b2bcea3512f75eb
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Wed Jan 3 10:26:12 2018 +0100
gdbus-codegen: Split license string
The license string which is embedded in the C header and body
preambles has been moved to a global variable. This way it can be
reused in both sections.
https://bugzilla.gnome.org/show_bug.cgi?id=791015
gio/gdbus-2.0/codegen/codegen.py | 40 +++++++++++++++++--------------------
1 files changed, 18 insertions(+), 22 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
index 1dbf94d..fd5c1cc 100644
--- a/gio/gdbus-2.0/codegen/codegen.py
+++ b/gio/gdbus-2.0/codegen/codegen.py
@@ -25,6 +25,13 @@ from . import config
from . import utils
from . import dbustypes
+LICENSE_STR = '''/*
+ * Generated by gdbus-codegen {!s}. DO NOT EDIT.
+ *
+ * The license of this code is the same as for the D-Bus interface description
+ * it was derived from.
+ */\n'''
+
# ----------------------------------------------------------------------------------------------------
class CodeGenerator:
@@ -55,14 +62,8 @@ class CodeGenerator:
# ----------------------------------------------------------------------------------------------------
def generate_intro(self):
- self.c.write('/*\n'
- ' * Generated by gdbus-codegen %s. DO NOT EDIT.\n'
- ' *\n'
- ' * The license of this code is the same as for the D-Bus interface description\n'
- ' * it was derived from.\n'
- ' */\n'
- '\n'
- %(config.VERSION))
+ self.c.write(LICENSE_STR.format(config.VERSION))
+ self.c.write('\n')
self.c.write('#ifdef HAVE_CONFIG_H\n'
'# include "config.h"\n'
'#endif\n'
@@ -220,20 +221,15 @@ class CodeGenerator:
'}\n'
'\n')
- self.h.write('/*\n'
- ' * Generated by gdbus-codegen %s. DO NOT EDIT.\n'
- ' *\n'
- ' * The license of this code is the same as for the D-Bus interface description\n'
- ' * it was derived from.\n'
- ' */\n'
- '\n'
- '#ifndef __%s__\n'
- '#define __%s__\n'
- '\n'%(config.VERSION, self.header_guard, self.header_guard))
- self.h.write('#include <gio/gio.h>\n'
- '\n'
- 'G_BEGIN_DECLS\n'
- '\n')
+ self.h.write(LICENSE_STR.format(config.VERSION))
+ self.h.write('\n')
+ self.h.write('#ifndef __{!s}__\n'.format(self.header_guard))
+ self.h.write('#define __{!s}__\n'.format(self.header_guard))
+ self.h.write('\n')
+ self.h.write('#include <gio/gio.h>\n')
+ self.h.write('\n')
+ self.h.write('G_BEGIN_DECLS\n')
+ self.h.write('\n')
# ----------------------------------------------------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]