aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-02-02 01:35:39 -0800
committerZac Medico <zmedico@gentoo.org>2020-02-03 01:26:35 -0800
commitcc73af5a6990dfa196c889421b8bcb77cf2d25e1 (patch)
treed388ffd455ceb622042d251a9693b057ea819844 /doc
parentDrop compat code for ancient python versions (diff)
downloadportage-cc73af5a6990dfa196c889421b8bcb77cf2d25e1.tar.gz
portage-cc73af5a6990dfa196c889421b8bcb77cf2d25e1.tar.bz2
portage-cc73af5a6990dfa196c889421b8bcb77cf2d25e1.zip
doc: replace epydoc with sphinx-apidoc + sphinx-epytext
Bug: https://bugs.gentoo.org/707820 Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/.gitignore1
-rw-r--r--doc/api/Makefile32
-rw-r--r--doc/api/conf.py66
-rw-r--r--doc/api/index.rst18
4 files changed, 117 insertions, 0 deletions
diff --git a/doc/api/.gitignore b/doc/api/.gitignore
new file mode 100644
index 000000000..796b96d1c
--- /dev/null
+++ b/doc/api/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/doc/api/Makefile b/doc/api/Makefile
new file mode 100644
index 000000000..56420a497
--- /dev/null
+++ b/doc/api/Makefile
@@ -0,0 +1,32 @@
+# Makefile for Sphinx documentation
+#
+
+SPHINX_APIDOC_OPTIONS = members,private-members,undoc-members,show-inheritance,ignore-module-all,inherited-members
+export SPHINX_APIDOC_OPTIONS
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+SOURCEDIR = .
+BUILDDIR = build
+TOPDIR = ../..
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+clean:
+ rm -rf $(BUILDDIR) $(SOURCEDIR)/api
+
+$(BUILDDIR)/_sources/portage.rst:
+ mkdir -p "$(BUILDDIR)/_sources"
+ cp -pPR "$(SOURCEDIR)/conf.py" "$(SOURCEDIR)/index.rst" "$(BUILDDIR)/_sources"
+ sphinx-apidoc -TPef -o "$(BUILDDIR)/_sources" $(TOPDIR)/lib/_emerge
+ sphinx-apidoc -TPef -o "$(BUILDDIR)/_sources" $(TOPDIR)/lib/portage $(TOPDIR)/lib/portage/tests
+
+.PHONY: help Makefile
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile $(BUILDDIR)/_sources/portage.rst
+ @$(SPHINXBUILD) -M $@ "$(BUILDDIR)/_sources" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/doc/api/conf.py b/doc/api/conf.py
new file mode 100644
index 000000000..f318ca25d
--- /dev/null
+++ b/doc/api/conf.py
@@ -0,0 +1,66 @@
+# Configuration file for the Sphinx documentation builder.
+#
+# This file only contains a selection of the most common options. For a full
+# list see the documentation:
+# http://www.sphinx-doc.org/en/master/config
+
+# -- Path setup --------------------------------------------------------------
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#
+# import os
+# import sys
+# sys.path.insert(0, os.path.abspath('.'))
+
+import os
+from os import path as osp
+import sys
+
+if osp.isfile(osp.abspath(osp.join(osp.dirname(__file__), "../../../../.portage_not_installed"))):
+ sys.path.insert(0, osp.abspath(osp.join(osp.dirname(__file__), "../../../../lib")))
+import portage
+
+# -- Project information -----------------------------------------------------
+
+project = 'portage'
+copyright = '2020, Gentoo Authors'
+author = 'Gentoo Authors'
+
+# The full version, including alpha/beta/rc tags
+release = str(portage.VERSION)
+
+# -- General configuration ---------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ 'sphinx.ext.autodoc',
+ 'sphinx_epytext',
+]
+
+# Add any paths that contain templates here, relative to this directory.
+# templates_path = []
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This pattern also affects html_static_path and html_extra_path.
+# exclude_patterns = []
+
+# -- Options for HTML output -------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+#
+html_show_sourcelink = False
+html_theme = 'sphinxdoc'
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+# html_static_path = []
+
+autodoc_default_options = dict((opt, True) for opt in
+ filter(None, os.environ.get('SPHINX_APIDOC_OPTIONS', '').split(',')))
diff --git a/doc/api/index.rst b/doc/api/index.rst
new file mode 100644
index 000000000..ffaece6c9
--- /dev/null
+++ b/doc/api/index.rst
@@ -0,0 +1,18 @@
+Portage API Documentation
+=========================
+
+Modules
+=======
+
+.. toctree::
+ :maxdepth: 1
+
+ _emerge
+ portage
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`