diff options
-rw-r--r-- | .gitlab-ci.yml | 1 | ||||
-rw-r--r-- | gtkdoc/mkdb.py | 4 | ||||
-rw-r--r-- | gtkdoc/mkhtml2.py | 22 | ||||
-rw-r--r-- | meson.build | 11 | ||||
-rwxr-xr-x[-rw-r--r--] | tests/highlight.py | 0 | ||||
-rw-r--r-- | tests/meson.build | 31 |
6 files changed, 42 insertions, 27 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee5dfbf..3f84030 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,6 +35,7 @@ meson-build: script: - meson --prefix /usr _build . - ninja -C _build + - meson test -C _build except: - tags diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py index 9404452..87fdf24 100644 --- a/gtkdoc/mkdb.py +++ b/gtkdoc/mkdb.py @@ -969,7 +969,7 @@ def OutputIndex(basename, apiindex): def OutputSinceIndexes(): """Generate the 'since' api index files.""" - for version in set(Since.values()): + for version in sorted(set(Since.values())): logging.info("Since : [%s]", version) index = {x: IndexEntriesSince[x] for x in IndexEntriesSince.keys() if Since[x] == version} OutputIndex("api-index-" + version, index) @@ -2491,7 +2491,7 @@ def OutputBook(main_file, book_top, book_bottom, obj_tree): <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include> </index> ''') - for version in set(Since.values()): + for version in sorted(set(Since.values())): dash_version = version.replace('.', '-') OUTPUT.write(''' <index id="api-index-%s" role="%s"> <title>Index of new API in %s</title> diff --git a/gtkdoc/mkhtml2.py b/gtkdoc/mkhtml2.py index f54a80d..2eb5c73 100644 --- a/gtkdoc/mkhtml2.py +++ b/gtkdoc/mkhtml2.py @@ -1751,6 +1751,21 @@ def create_devhelp2(out_dir, module, xml, files): idx.write(line) +class FakeDTDResolver(etree.Resolver): + """Don't load the docbookx.dtd since we disable the validation anyway. + + libxsml2 does not cache DTDs. If we produce a docbook file with 100 chunks + loading such a doc with xincluding will load and parse the docbook DTD 100 + times. This cases tons of memory allocations and is slow. + """ + + def resolve(self, url, id, context): + if not url.endswith('.dtd'): + return None + # http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd + return self.resolve_string('', context) + + def main(module, index_file, out_dir, uninstalled, src_lang, paths): # == Loading phase == @@ -1758,10 +1773,9 @@ def main(module, index_file, out_dir, uninstalled, src_lang, paths): # 1) load the docuemnt _t = timer() - # does not seem to be faster - # parser = etree.XMLParser(dtd_validation=False, collect_ids=False) - # tree = etree.parse(index_file, parser) - tree = etree.parse(index_file) + parser = etree.XMLParser(dtd_validation=False, collect_ids=False) + parser.resolvers.add(FakeDTDResolver()) + tree = etree.parse(index_file, parser) logging.warning("1a: %7.3lf: load doc", timer() - _t) _t = timer() tree.xinclude() diff --git a/meson.build b/meson.build index f7d785f..e821e35 100644 --- a/meson.build +++ b/meson.build @@ -13,8 +13,8 @@ version = meson.project_version() package_name = meson.project_name() # Paths -srcdir = meson.source_root() -builddir = meson.build_root() +srcdir = meson.current_source_dir() +builddir = meson.current_build_dir() prefix = get_option('prefix') @@ -32,9 +32,6 @@ pkgconfigdir = join_paths(datadir, 'pkgconfig') # Dependencies glib_req = '>= 2.38.0' -python3_req = '>= 3.4.0' - -python3_dep = dependency('python3', version: python3_req) python_prg = python3 @@ -165,7 +162,9 @@ configure_file( ) subdir('help') -subdir('tests') +if get_option('tests') + subdir('tests') +endif # A dummy dependency object that to use gtkdoc as subproject fallback # To be used as: dependency('gtk-doc', fallback : ['gtk-doc', 'dummy_dep']) diff --git a/tests/highlight.py b/tests/highlight.py index 7c88049..7c88049 100644..100755 --- a/tests/highlight.py +++ b/tests/highlight.py diff --git a/tests/meson.build b/tests/meson.build index a60cf46..92add69 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -8,11 +8,14 @@ gtkdoc_unit_tests = [ 'scan', ] +test_env = environment() +test_env.append('PYTHONPATH', srcdir, builddir) + foreach test_name: gtkdoc_unit_tests test( 'test-unit-@0@'.format(test_name), python_prg, - env: ['PYTHONPATH=@0@'.format(builddir)], + env: test_env, args: [ join_paths( srcdir, @@ -25,20 +28,18 @@ endforeach subdir('helpers') -if get_option('tests') == true - glib_dep = dependency('glib-2.0', version: glib_req) - gobject_dep = dependency('gobject-2.0', version: glib_req) +glib_dep = dependency('glib-2.0', version: glib_req) +gobject_dep = dependency('gobject-2.0', version: glib_req) - glib_prefix = glib_dep.get_pkgconfig_variable('prefix') - glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') +glib_prefix = glib_dep.get_pkgconfig_variable('prefix') +glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') - gobject_prefix = gobject_dep.get_pkgconfig_variable('prefix') - gobject_docpath = join_paths(gobject_prefix, 'share', 'gtk-doc', 'html') +gobject_prefix = gobject_dep.get_pkgconfig_variable('prefix') +gobject_docpath = join_paths(gobject_prefix, 'share', 'gtk-doc', 'html') - subdir('annotations') - subdir('bugs') - subdir('empty') - subdir('fail') - subdir('gobject') - subdir('program') -endif +subdir('annotations') +subdir('bugs') +subdir('empty') +subdir('fail') +subdir('gobject') +subdir('program') |