From 9327736e7142ec7939b8e5eea061c475632b0065 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 18 Mar 2015 22:23:03 +0000 Subject: [PATCH] Add boilerplate for Sphinx doc rendering This is the necessary boilerplate configuration to be able to run Sphinx via PBR from tox and render reStructuredText into HTML for publication. Also add the httpdomain contrib plugin for Sphinx since this project will include some HTTP API documentation. Change-Id: Ied0092e2965463abe0c86d37047faa6b47d1bc97 --- .gitignore | 6 +++ doc/source/conf.py | 94 ++++++++++++++++++++++++++++++++++++++++++++ doc/source/index.rst | 0 requirements.txt | 4 ++ setup.cfg | 23 +++++++++++ setup.py | 21 ++++++++++ tox.ini | 22 +++++++++++ 7 files changed, 170 insertions(+) create mode 100644 doc/source/conf.py create mode 100644 doc/source/index.rst create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 668cd84f..a727b5d7 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,9 @@ app/config/packages/greggilbert/recaptcha/production/* app/config/packages/greggilbert/recaptcha/staging/* /bootstrap/compiled.php /bootstrap/environment.php +.tox +AUTHORS +ChangeLog +doc/build +*.egg +*.egg-info diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100644 index 00000000..2785b514 --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import datetime +import os +import sys + +sys.path.insert(0, 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.autodoc', + 'sphinxcontrib.httpdomain', + #'sphinx.ext.intersphinx', + 'oslosphinx', + 'yasfb', +] + +# Feed configuration for yasfb +feed_base_url = 'http://ci.openstack.org/openstackid' +feed_author = 'OpenStack Infrastructure Team' + +exclude_patterns = [ + 'template.rst', +] + +# Optionally allow the use of sphinxcontrib.spelling to verify the +# spelling of the documents. +try: + import sphinxcontrib.spelling + extensions.append('sphinxcontrib.spelling') +except ImportError: + pass + +# autodoc generation is a bit aggressive and a nuisance when doing heavy +# text edit cycles. +# execute "export SPHINX_DEBUG=1" in your terminal to disable + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'openstackid' +copyright = u'%s, OpenStack Foundation' % datetime.date.today().year + +# 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 + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# -- 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_path = ["."] +# html_theme = '_theme' +# html_static_path = ['static'] + +# Output file base name for HTML help builder. +htmlhelp_basename = '%sdoc' % project + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass +# [howto/manual]). +latex_documents = [ + ('index', + '%s.tex' % project, + u'%s Documentation' % project, + u'OpenStack Foundation', 'manual'), +] + +# Example configuration for intersphinx: refer to the Python standard library. +#intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 00000000..e69de29b diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..c2e40782 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +oslosphinx +sphinx>=1.1.2,<1.2 +sphinxcontrib-httpdomain +yasfb>=0.5.1 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..634061ea --- /dev/null +++ b/setup.cfg @@ -0,0 +1,23 @@ +[metadata] +name = infra-specs +summary = OpenStackID Authentication system for the OpenStack Foundation site +description-file = + README.rst +author = OpenStack +author-email = openstack-infra@lists.openstack.org +home-page = http://www.openstack.org/ +classifier = + Environment :: OpenStack + Intended Audience :: Developers + Operating System :: POSIX :: Linux + +[build_sphinx] +source-dir = doc/source +build-dir = doc/build +all_files = 1 + +[pbr] +warnerrors = True + +[upload_sphinx] +upload-dir = doc/build/html diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..c0a24eab --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import setuptools + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..a1109dae --- /dev/null +++ b/tox.ini @@ -0,0 +1,22 @@ +[tox] +minversion = 1.6 +envlist = docs + +[testenv] +install_command = pip install -U {opts} {packages} +setenv = + VIRTUAL_ENV={envdir} +deps = -r{toxinidir}/requirements.txt + +[testenv:venv] +commands = {posargs} + +[testenv:docs] +commands = python setup.py build_sphinx + +[testenv:spelling] +deps = + -r{toxinidir}/requirements.txt + sphinxcontrib-spelling + PyEnchant +commands = sphinx-build -b spelling doc/source doc/build/spelling