From 7f78b8aafcc7469fc3876653ef8d7895762d59b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Fri, 22 Dec 2017 21:04:00 +0100 Subject: [PATCH] gnome.gtkdoc: Extend GtkDoc test The GtkDoc test has been extended to also test the inclusion of generated files. To test this, a new python script has been included which generates a new docbook file which is included as content file. --- .../10 gtk-doc/doc/foobar-docs.sgml | 1 + .../frameworks/10 gtk-doc/doc/meson.build | 6 +- .../include/generate-enums-docbook.py | 63 +++++++++++++++++++ .../frameworks/10 gtk-doc/include/meson.build | 6 ++ 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 test cases/frameworks/10 gtk-doc/include/generate-enums-docbook.py diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml b/test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml index 028b80830..389431751 100644 --- a/test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml +++ b/test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml @@ -34,6 +34,7 @@ + diff --git a/test cases/frameworks/10 gtk-doc/doc/meson.build b/test cases/frameworks/10 gtk-doc/doc/meson.build index 5f08e89ef..7aeb98d91 100644 --- a/test cases/frameworks/10 gtk-doc/doc/meson.build +++ b/test cases/frameworks/10 gtk-doc/doc/meson.build @@ -4,4 +4,8 @@ configure_file(input : 'version.xml.in', output : 'version.xml', configuration : cdata) -gnome.gtkdoc('foobar', src_dir : inc, main_sgml : 'foobar-docs.sgml', install : true) +gnome.gtkdoc('foobar', + src_dir : inc, + main_sgml : 'foobar-docs.sgml', + content_files : docbook, + install : true) diff --git a/test cases/frameworks/10 gtk-doc/include/generate-enums-docbook.py b/test cases/frameworks/10 gtk-doc/include/generate-enums-docbook.py new file mode 100644 index 000000000..41c6121b2 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/include/generate-enums-docbook.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 + +import sys + +DOC_HEADER = ''' + + + + + + {0} + {0} + + + {0} + + + + + enum {1} + + {1} + + {1} + + Values + + + + + + +''' + +DOC_ENUM = ''' + {0} + = {1} + + ''' + +DOC_FOOTER = ''' + + + + + + +''' + +if __name__ == '__main__': + if len(sys.argv) >= 4: + with open(sys.argv[1], 'w') as doc_out: + enum_name = sys.argv[2] + enum_type = sys.argv[3] + + doc_out.write(DOC_HEADER.format(enum_name, enum_type)) + for i, enum in enumerate(sys.argv[4:]): + doc_out.write(DOC_ENUM.format(enum, i)) + doc_out.write(DOC_FOOTER) + else: + print('Use: ' + sys.argv[0] + ' out name type [enums]') + + sys.exit(0) diff --git a/test cases/frameworks/10 gtk-doc/include/meson.build b/test cases/frameworks/10 gtk-doc/include/meson.build index 4c85b801d..f6dd99fae 100644 --- a/test cases/frameworks/10 gtk-doc/include/meson.build +++ b/test cases/frameworks/10 gtk-doc/include/meson.build @@ -8,3 +8,9 @@ configure_file(input : 'foo-version.h.in', configuration : cdata, install : true, install_dir : get_option('includedir')) + +generate_enums_docbook = find_program('generate-enums-docbook.py') + +docbook = custom_target('enum-docbook', + output : 'bar.xml', + command : [generate_enums_docbook, '@OUTPUT@', 'BAR', 'BAR_TYPE', 'BAR_FOO'])