qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cleber Rosa <crosa@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Aleksandar Markovic" <amarkovic@wavecomp.com>
Subject: Re: [Qemu-devel] [PATCH v3 08/12] docs: Provide separate conf.py for each manual we want
Date: Wed, 6 Mar 2019 20:40:28 -0500	[thread overview]
Message-ID: <20190307014028.hggeogcxuwldc5ms@localhost.localdomain> (raw)
In-Reply-To: <20190305172139.32662-9-peter.maydell@linaro.org>

On Tue, Mar 05, 2019 at 05:21:35PM +0000, Peter Maydell wrote:
> By default Sphinx wants to build a single manual at once.
> For QEMU, this doesn't suit us, because we want to have
> separate manuals for "Developer's Guide", "User Manual",
> and so on, and we don't want to ship the Developer's Guide
> to end-users. However, we don't want to completely duplicate
> conf.py for each manual, and we'd like to continue to
> support "build all docs in one run" for third-party sites
> like readthedocs.org.
> 
> Make the top-level conf.py support two usage forms:
>  (1) as a common config file which is included by the conf.py
>  for each of QEMU's manuals: in this case sphinx-build is run
>  multiple times, once per subdirectory.
>  (2) as a top level conf file which will result in building all
>  the manuals into a single document: in this case sphinx-build is
>  run once, on the top-level docs directory.
> 
> Provide per-manual conf.py files and top level pages for
> our first two manuals:
>  * QEMU Developer's Guide (docs/devel)
>  * QEMU System Emulation Management and Interoperability Guide
>    (docs/interop)
>

I have the impression that this can be simplified by making use of
"only" tags:

https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-only

So, conf.py could detect if it's being run on readthedocs.org:

  ON_RTD = os.environ.get('READTHEDOCS', None) == 'True'

And manipulate the "tags" variable accordingly:

  if ON_RTD:
     tags.add('devel')
     tags.add('interop')

Then, on an index.rst, it could be a simple matter of:

.. only:: devel
================
Developers Guide
================
.. toctree::
   docs/devel

.. only:: interop
=============
Interop Guide
=============
.. toctree::
   docs/interop

.. only:: devel and interop
===============
QEMU Full Guide
===============
.. toctree::
   docs/devel
   docs/interop

Or some alternative layout.  Please beware that I haven't performed a
full examination of that (or similar) approach.

If that doesn't work, I'd consider having a top level "common.py",
whose contents are imported by the various "conf.py", instead of
exec()'d.  That I've tried, and a simple:

  from common import *
  release = 'overridden_value'

Works as expected and is respected by sphinx.

- Cleber.

  reply	other threads:[~2019-03-07  1:40 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 17:21 [Qemu-devel] [PATCH v3 00/12] Enable build and install of our rST docs Peter Maydell
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 01/12] docs/cpu-hotplug.rst: Fix rST markup issues Peter Maydell
2019-03-05 22:34   ` Richard Henderson
2019-03-07  0:04   ` Cleber Rosa
2019-03-07  9:47     ` Peter Maydell
2019-03-07 11:15       ` Cleber Rosa
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 02/12] docs: Convert memory.txt to rst format Peter Maydell
2019-03-05 22:40   ` Richard Henderson
2019-03-07  0:11   ` Cleber Rosa
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 03/12] docs: Commit initial files from sphinx-quickstart Peter Maydell
2019-03-05 22:36   ` Richard Henderson
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 04/12] docs/conf.py: Disable unused _static directory Peter Maydell
2019-03-05 22:36   ` Richard Henderson
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 05/12] docs/conf.py: Configure the 'alabaster' theme Peter Maydell
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 06/12] docs/conf.py: Don't include rST sources in HTML build Peter Maydell
2019-03-05 22:42   ` Richard Henderson
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 07/12] docs/conf.py: Disable option warnings Peter Maydell
2019-03-05 22:42   ` Richard Henderson
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 08/12] docs: Provide separate conf.py for each manual we want Peter Maydell
2019-03-07  1:40   ` Cleber Rosa [this message]
2019-03-07  9:49     ` Peter Maydell
2019-03-07 12:14       ` Cleber Rosa
2019-03-07 12:29         ` Peter Maydell
2019-03-07 13:18           ` Cleber Rosa
2019-03-07 13:30             ` Peter Maydell
2019-03-07 13:41               ` Cleber Rosa
2019-03-07 13:46                 ` Peter Maydell
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 09/12] Makefile, configure: Support building rST documentation Peter Maydell
2019-03-05 22:45   ` Richard Henderson
     [not found]   ` <92ffba93-e486-647a-01ef-86180fb2cbb2@redhat.com>
2019-04-01  7:58     ` Peter Maydell
2019-04-01 12:51       ` Eric Blake
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 10/12] Makefile: Abstract out "identify the pkgversion" code Peter Maydell
2019-03-05 22:33   ` Richard Henderson
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 11/12] docs/conf.py: Don't hard-code QEMU version Peter Maydell
2019-03-05 22:46   ` Richard Henderson
2019-03-05 17:21 ` [Qemu-devel] [PATCH v3 12/12] MAINTAINERS: Add entry for Sphinx documentation infrastructure Peter Maydell
2019-03-05 18:08   ` Philippe Mathieu-Daudé
2019-03-05 22:47   ` Richard Henderson
2019-03-05 17:44 ` [Qemu-devel] [PATCH v3 00/12] Enable build and install of our rST docs no-reply
2019-03-05 18:17 ` no-reply
2019-03-06  1:28 ` no-reply
2019-03-06  1:32 ` no-reply
2019-03-07  0:10 ` no-reply
2019-03-07  0:15 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190307014028.hggeogcxuwldc5ms@localhost.localdomain \
    --to=crosa@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=amarkovic@wavecomp.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).