From d17e74b43b39b62abfbd543d9a7f0516c235be15 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Sat, 9 May 2009 23:18:06 +0200 Subject: [PATCH] Switch the documentation to sphinx This big patch converts the documentation build system to sphinx (http://sphinx.pocoo.org/). Since that uses reStructuredText sources too, there is no change (yet) in the documents themselves, just in the build system. As before, the docs are pre built by the maintainer, and the end-user doesn't need sphinx or other rst tools to build the docs. Note that we are not distributing PDFs, so building that will require the tools. The docs will be stored under doc/html and the build system also need an extra directory doc/build. These are considered (by automake) maintainer-related objects and are removed at maintainer-clean time. The patch also fixes some small issues: add a docpng variable, add doc/api (also generated by maintainer) in maintainer-clean-local, etc. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- .gitignore | 5 +- DEVNOTES | 13 ++-- INSTALL | 1 + Makefile.am | 32 +++++---- configure.ac | 10 +-- doc/conf.py | 195 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/index.rst | 20 ++++++ 7 files changed, 251 insertions(+), 25 deletions(-) create mode 100644 doc/conf.py create mode 100644 doc/index.rst diff --git a/.gitignore b/.gitignore index 0b4512b15..aac33b907 100644 --- a/.gitignore +++ b/.gitignore @@ -32,11 +32,10 @@ # doc /doc/api -/doc/*.html +/doc/build +/doc/html /doc/*.in -/doc/*.pdf /doc/*.png -/doc/rapi-resources.gen # doc/examples /doc/examples/bash_completion diff --git a/DEVNOTES b/DEVNOTES index b4146c47b..35b93ddaf 100644 --- a/DEVNOTES +++ b/DEVNOTES @@ -7,8 +7,8 @@ Build dependencies Most dependencies from INSTALL, plus: - docbook2html, docbook2man from Docbook tools http://sources.redhat.com/docbook-tools/ - - rst2html from Docutils - http://docutils.sourceforge.net/ + - python-sphinx (tested with version 0.6.1) from + http://sphinx.pocoo.org/ - graphviz http://www.graphviz.org/ @@ -16,6 +16,9 @@ Most dependencies from INSTALL, plus: Configuring for development --------------------------- -sh autogen.sh && \ -./configure PYTHON=python2.4 --enable-maintainer-mode \ - --prefix=/usr/local --sysconfdir=/etc --localstatedir=/var +Run the following command (only use ``PYTHON=...`` if you need to use a +different python version):: + + sh autogen.sh && \ + ./configure PYTHON=python2.4 \ + --prefix=/usr/local --sysconfdir=/etc --localstatedir=/var diff --git a/INSTALL b/INSTALL index 5f5dda3d9..857ff1a27 100644 --- a/INSTALL +++ b/INSTALL @@ -56,6 +56,7 @@ Before initialising the cluster, on each node you need to create the following directories: - /etc/ganeti + - /var/lib/ganeti, /var/log/ganeti - /srv/ganeti, /srv/ganeti/os, /srv/ganeti/export After this, use ``gnt-cluster init``. diff --git a/Makefile.am b/Makefile.am index d441fae76..043ca8e5c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,10 +37,12 @@ DIRS = \ tools MAINTAINERCLEANFILES = \ - $(dochtml) \ - $(patsubst %.dot,%.png,$(docdot)) \ + $(docpng) \ $(maninput) +maintainer-clean-local: + -rm -rf doc/api doc/build doc/html + CLEANFILES = \ autotools/replace_vars.sed \ devel/upload \ @@ -111,18 +113,28 @@ docrst = \ doc/design-2.0.rst \ doc/hooks.rst \ doc/iallocator.rst \ + doc/index.rst \ doc/install.rst \ doc/rapi.rst \ doc/security.rst -dochtml = $(patsubst %.rst,%.html,$(docrst)) +doc/html: $(docrst) $(docpng) doc/conf.py configure.ac + @test -n "$(SPHINX)" || \ + { echo 'sphinx-build' not found during configure; exit 1; } + mkdir -p doc/build/doctrees + PYTHONPATH=.:$(top_builddir) sphinx-build -q -b html \ + -d doc/build/doctrees \ + -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \ + -D release="$(PACKAGE_VERSION)" \ + $(top_srcdir)/doc doc/html + touch "$@" docdot = \ doc/arch-2.0.dot -doc_DATA = $(dochtml) +docpng = $(patsubst %.dot,%.png,$(docdot)) -noinst_DATA = $(manhtml) +noinst_DATA = $(manhtml) doc/html dist_sbin_SCRIPTS = \ daemons/ganeti-noded \ @@ -149,8 +161,10 @@ EXTRA_DIST = \ DEVNOTES \ autotools/docbook-wrapper \ devel/upload.in \ - $(docrst) \ $(docdot) \ + $(docrst) \ + doc/conf.py \ + doc/html \ doc/examples/bash_completion.in \ doc/examples/ganeti.initd.in \ doc/examples/ganeti.cron.in \ @@ -234,16 +248,10 @@ doc/examples/%: doc/examples/%.in stamp-directories \ $(REPLACE_VARS_SED) sed -f $(REPLACE_VARS_SED) < $< > $@ -doc/%.html: doc/%.rst - @test -n "$(RST2HTML)" || { echo 'rst2html' not found during configure; exit 1; } - $(RST2HTML) $< $@ - doc/%.png: doc/%.dot @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; } $(DOT) -Tpng -o $@ $< -doc/design-2.0.html: doc/design-2.0.rst doc/arch-2.0.png - man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER) @test -n "$(DOCBOOK2MAN)" || { echo 'docbook2html' not found during configure; exit 1; } TMPDIR=`mktemp -d` && { \ diff --git a/configure.ac b/configure.ac index 75e3531b4..905402ecd 100644 --- a/configure.ac +++ b/configure.ac @@ -138,12 +138,12 @@ then AC_MSG_WARN([docbook2html not found, man pages rebuild will not be possible]) fi -# Check for rst programs -AC_ARG_VAR(RST2HTML, [rst2html path]) -AC_PATH_PROG(RST2HTML, [rst2html], []) -if test -z "$RST2HTML" +# Check for python-sphinx +AC_ARG_VAR(SPHINX, [sphinx-build path]) +AC_PATH_PROG(SPHINX, [sphinx-build], []) +if test -z "$SPHINX" then - AC_MSG_WARN([rst2html not found, documentation rebuild will not be possible]) + AC_MSG_WARN([sphinx-build not found, documentation rebuild will not be possible]) fi # Check for graphviz (dot) diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 000000000..8b525392f --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,195 @@ +# -*- coding: utf-8 -*- +# +# Ganeti documentation build configuration file, created by +# sphinx-quickstart on Tue Apr 14 13:23:20 2009. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# 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. +#sys.path.append(os.path.abspath('.')) + +# -- 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.todo'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +source_encoding = 'utf-8' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'Ganeti' +copyright = u'2006, 2007, 2008, 2009, Google Inc.' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# These next two will be passed via the command line, see the makefile +# The short X.Y version +#version = VERSION_MAJOR + "." + VERSION_MINOR +# The full version, including alpha/beta/rc tags. +#release = PACKAGE_VERSION + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +language = 'en' + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +#unused_docs = [] + +# List of directories, relative to source directory, that shouldn't be searched +# for source files. +exclude_trees = ['_build', 'examples', 'api'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# 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 = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +html_use_modindex = False + +# If false, no index is generated. +html_use_index = False + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'Ganetidoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'Ganeti.tex', u'Ganeti Documentation', + u'Google Inc.', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +latex_use_modindex = False diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 000000000..f9e698a23 --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,20 @@ +.. Ganeti documentation master file, + created by sphinx-quickstart + +Welcome to Ganeti's documentation! +================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + install.rst + admin.rst + security.rst + design-2.0.rst + hooks.rst + iallocator.rst + rapi.rst + +Also see the :ref:`search`. -- GitLab