How to Install Sphinx
This post summarizes how to install sphinx on Windows to contribute to PyQGIS Cookbook. I’m writing this as I go, so this most likely won’t be perfect.
I used my Python 2.6 stand-alone installation (not the one in OSGeo4W).
- Get the Sphinx egg from http://pypi.python.org/pypi/Sphinx
- If you don’t have it, install setuptools to get the easy_install script http://pypi.python.org/pypi/setuptools
- In C:\Python26\Scripts run
easy_install -U sphinx
- Get the PyQGIS source from https://github.com/qgis/QGIS-Developer-Cookbook
- Create a build folder inside the QGIS-Developer-Cookbook
- Now you can build the Cookbook:
sphinx-build "C:\Users\Anita\QGIS\QGIS-Developer-Cookbook\source" "C:\Users\Anita\QGIS\QGIS-Developer-Cookbook\build"
The build folder should now contain the Cookbook .html files.
Hello,
You could prefer to get bootstrap.py script to create python virtual env and add sphinx and other stuff with buildout. This allows to get all command almost ready for developper in svn with the current version used.
See https://github.com/yjacolin/GeoDocFr/tree/master/gdal how I use it.
Y.
Hi Yves,
I’m sorry, could you explain how bootstrap.py makes working with Sphinx easier? Right now, I just have to execute one function from command line. Seems simple to me. Thank you!
Hi,
I think this is mainly a best practice rather making things easier. Here some though about why use a bootstrap.py script with buildout config:
* if you are working on several documentation with different configuration, different sphinx version, you have one virtual env for each documentation and you don’t “pollute” your system.
* if several contributors are working together, you are sure that all contributor will have the same version of sphinx and other dependancies.
Finally I always used the MakeFile created: on Windows this is something like “make.bat html”
Y.
There is a make.bat file in PyQGIS directory, which can be used to create cookbook in HTML, PDF or any other Sphinx supported format. So there is no need to run sphinx-build manually. Just cd to cookbook folder and run “make.bat” to get help or “make.bat html” to get cookbook in HTML format.