| 1 |
==================================================================== |
| 2 |
:mod:`cloud_sptheme.make_helper` - sphinx-build Makefile replacement |
| 3 |
==================================================================== |
| 4 |
|
| 5 |
.. module:: cloud_sptheme.make_helper |
| 6 |
:synopsis: sphinx-build Makefile replacement |
| 7 |
|
| 8 |
This module was written to solve one specific task: |
| 9 |
to provide an alternative to the ``Makefile`` and ``make.bat`` scripts |
| 10 |
found in many Sphinx projects. Most sphinx projects rely on the presence |
| 11 |
of :command:`make`, do not frequently need documentation built on windows, |
| 12 |
and don't find the need to update the makefile once set up. However, |
| 13 |
for the small subset of projects this doesn't include, this class |
| 14 |
provides an easy pure-python way to make a cross-platform build script. |
| 15 |
|
| 16 |
Usage |
| 17 |
===== |
| 18 |
In order to use this script, go to your documentation's source directory, |
| 19 |
and include the following fragment as the file ``make.py``:: |
| 20 |
|
| 21 |
"Makefile for Sphinx documentation, adapted to python" |
| 22 |
import os |
| 23 |
from cloud_sptheme.make_helper import SphinxMaker |
| 24 |
if __name__ == "__main__": |
| 25 |
SphinxMaker.execute(root_dir=os.path.join(__file__,os.pardir)) |
| 26 |
|
| 27 |
Once done, this script can be invoked via :samp:`python docs/make.py {options}`, |
| 28 |
in the same manner as the Sphinx Makefile and make.bat script. |
| 29 |
|
| 30 |
Any new features added to SphinxMaker via cloud_sptheme will automatically become |
| 31 |
available to all packages using this stub. |
| 32 |
|
| 33 |
Interface |
| 34 |
========= |
| 35 |
|
| 36 |
.. class:: SphinxMaker(root_dir=None) |
| 37 |
|
| 38 |
:param root_dir: |
| 39 |
absolute path pointing to documentation source directory. |
| 40 |
|
| 41 |
The following are class attributes, but they may be |
| 42 |
overridden via subclass, constructor, or environment variable |
| 43 |
(in increasing order of precedence). |
| 44 |
|
| 45 |
.. attribute:: BUILD |
| 46 |
|
| 47 |
the build directory. this defaults to ``_build``, |
| 48 |
|
| 49 |
.. attribute:: SPHINXBUILD |
| 50 |
|
| 51 |
path to sphinx-build script, defaults to ``sphinx-build``. |
| 52 |
|
| 53 |
.. attribute:: PAPER |
| 54 |
|
| 55 |
paper size for latex, defaults to ``letter``. |
| 56 |
|
| 57 |
.. attribute:: SERVEHTML_PORT |
| 58 |
|
| 59 |
port for ``servehtml`` to launch a webserver on, defaults to 8000. |
| 60 |
|
| 61 |
.. todo:: |
| 62 |
|
| 63 |
SphinxMaker does not currently include all the build targets that sphinx-quickstart's Makefile contains, |
| 64 |
this should be fixed. |
| 65 |
|
| 66 |
SphinxMaker may currently contain some assumptions which don't apply to some sphinx project layouts, |
| 67 |
these should be identified and made configurable. |