diff options
author | James Le Cuirot <chewi@gentoo.org> | 2023-07-15 12:20:27 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-08-02 07:31:19 +0100 |
commit | ad3994394af0bc975ec7c28bd60de496b580c25e (patch) | |
tree | 6d7d1321e8c1a9ef585764a67cc0694762a9b217 /doc | |
parent | Linting fixes (diff) | |
download | portage-ad3994394af0bc975ec7c28bd60de496b580c25e.tar.gz portage-ad3994394af0bc975ec7c28bd60de496b580c25e.tar.bz2 portage-ad3994394af0bc975ec7c28bd60de496b580c25e.zip |
Migrate from setuptools to Meson and meson-python
This makes Portage PEP 517 compliant.
When building via meson-python, the man pages and logrotate config are
no longer included as there seems little point.
Bug: https://bugs.gentoo.org/910035
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/meson.build | 43 | ||||
-rw-r--r-- | doc/fragment/meson.build | 5 | ||||
-rw-r--r-- | doc/fragment/version.in | 1 | ||||
-rw-r--r-- | doc/meson.build | 57 | ||||
-rw-r--r-- | doc/portage.docbook | 2 |
5 files changed, 106 insertions, 2 deletions
diff --git a/doc/api/meson.build b/doc/api/meson.build new file mode 100644 index 000000000..294be6d07 --- /dev/null +++ b/doc/api/meson.build @@ -0,0 +1,43 @@ +sphinx_apidoc = find_program('sphinx-apidoc', required : get_option('apidoc')) +sphinx_build = find_program('sphinx-build', required : get_option('apidoc')) + +if not sphinx_apidoc.found() or not sphinx_build.found() + subdir_done() +endif + +api_symlinks = custom_target( + 'symlinks', + input: ['conf.py', 'index.rst'], + output : ['conf.py', 'index.rst'], + command : ['ln', '-srnf', '@INPUT@', '@OUTDIR@/'] +) + +api_rst = custom_target( + 'rst', + output : ['portage.rst'], + command : [sphinx_apidoc, '-TPef', '-o', '@OUTDIR@', '@SOURCE_ROOT@/lib', '@SOURCE_ROOT@/lib/portage/tests'], + env : {'SPHINX_APIDOC_OPTIONS' : 'members,private-members,undoc-members,show-inheritance,ignore-module-all,inherited-members'} +) + +# sphinx-build generates a lot of files, and it would be awkward to keep a list +# updated. This workaround is slightly hacky as you're probably not supposed to +# set "output" to a directory. Note that it cannot include a /. We use +# install_subdir here, unlike in the parent directory, because it can use a +# different name for the destination and can exclude some files. + +custom_target( + 'html', + depends: [api_symlinks, api_rst], + output : ['html'], + command : [sphinx_build, '-M', 'html', '@OUTDIR@', '@OUTDIR@/html'], + build_by_default : get_option('apidoc') +) + +if get_option('apidoc') + install_subdir( + meson.current_build_dir() / 'html' / 'html', + exclude_directories : ['_sources'], + strip_directory : true, + install_dir : docdir / 'html' / 'api' + ) +endif diff --git a/doc/fragment/meson.build b/doc/fragment/meson.build new file mode 100644 index 000000000..c5604d3f0 --- /dev/null +++ b/doc/fragment/meson.build @@ -0,0 +1,5 @@ +version_doc_fragment = configure_file( + input : 'version.in', + output : 'version', + configuration : conf_data +) diff --git a/doc/fragment/version.in b/doc/fragment/version.in new file mode 100644 index 000000000..2ca11428e --- /dev/null +++ b/doc/fragment/version.in @@ -0,0 +1 @@ +<releaseinfo>@VERSION@</releaseinfo> diff --git a/doc/meson.build b/doc/meson.build new file mode 100644 index 000000000..a671d7114 --- /dev/null +++ b/doc/meson.build @@ -0,0 +1,57 @@ +subdir('api') +subdir('fragment') + +xmlto = find_program('xmlto', required : get_option('doc')) + +if not xmlto.found() + subdir_done() +endif + +docbook_src = [ + version_doc_fragment, + 'config.docbook', + 'config/bashrc.docbook', + 'config/sets.docbook', + 'custom.xsl', + 'dependency_resolution.docbook', + 'dependency_resolution/decision_making.docbook', + 'dependency_resolution/package_modeling.docbook', + 'dependency_resolution/task_scheduling.docbook', + 'package.docbook', + 'package/ebuild.docbook', + 'package/ebuild/eapi/0.docbook', + 'package/ebuild/eapi/1.docbook', + 'package/ebuild/eapi/2.docbook', + 'package/ebuild/eapi/3.docbook', + 'package/ebuild/eapi/4.docbook', + 'package/ebuild/eapi/4-slot-abi.docbook', + 'package/ebuild/eapi/5.docbook', + 'package/ebuild/helper_functions.docbook', + 'package/ebuild/phases.docbook', + 'portage.docbook', + 'qa.docbook' +] + +custom_target( + 'xhtml-nochunks', + depend_files : docbook_src, + output : ['portage.html'], + command : ['xmlto', '-o', '@OUTDIR@', '--searchpath', '@OUTDIR@/fragment', '-m', '@CURRENT_SOURCE_DIR@/custom.xsl', 'xhtml-nochunks', '@CURRENT_SOURCE_DIR@/portage.docbook'], + install : get_option('doc') and get_option('doc-formats').contains('xhtml-nochunks'), + install_dir : docdir / 'html' +) + +# xhtml generates a lot of files, and it would be awkward to keep a list +# updated. This workaround is slightly hacky as you're probably not supposed to +# set "output" to a directory. Note that it cannot include a /. Another +# alternative is to use install_subdir, but it's not much better as you still +# need to set "output" to a directory. + +custom_target( + 'xhtml', + depend_files : docbook_src, + output : ['html'], + command : ['xmlto', '-o', '@OUTDIR@/html', '--searchpath', '@OUTDIR@/fragment', '-m', '@CURRENT_SOURCE_DIR@/custom.xsl', 'xhtml', '@CURRENT_SOURCE_DIR@/portage.docbook'], + install : get_option('doc') and get_option('doc-formats').contains('xhtml'), + install_dir : docdir +) diff --git a/doc/portage.docbook b/doc/portage.docbook index 77cf7e87e..6e9ad74d6 100644 --- a/doc/portage.docbook +++ b/doc/portage.docbook @@ -2,7 +2,6 @@ <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ - <!ENTITY date SYSTEM "fragment/date"> <!ENTITY version SYSTEM "fragment/version"> <!ENTITY project "portage"> @@ -52,7 +51,6 @@ </authorgroup> &version; - &date; </bookinfo> &config; |