Add a bit of sphinx

This commit is contained in:
Liam Young
2018-05-30 15:29:45 +01:00
parent f724044e4a
commit 7517faf19a
9 changed files with 206 additions and 25 deletions

2
.gitignore vendored
View File

@@ -4,3 +4,5 @@ build/
dist/
.local
zaza.egg-info/
# Sphinx
doc/build

2
doc-requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
sphinx
sphinxcontrib-trio

46
doc/source/api.rst Normal file
View File

@@ -0,0 +1,46 @@
===========================
Utilities API documentation
===========================
OpenStack Utilities
-------------------
.. automodule:: zaza.utilities.openstack
:members:
TLS Certificate Utilities
-------------------------
.. automodule:: zaza.utilities.cert
:members:
CLI Utilities
-------------
.. automodule:: zaza.utilities.cli
:members:
Utility Exceptions
------------------
.. automodule:: zaza.utilities.exceptions
:members:
Generic Utilities
-----------------
.. automodule:: zaza.utilities.generic
:members:
Juju Utilities
--------------
.. automodule:: zaza.utilities.juju
:members:
OpenStack Versions
------------------
.. automodule:: zaza.utilities.os_versions
:members:

74
doc/source/conf.py Executable file
View File

@@ -0,0 +1,74 @@
# -*- 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 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',
#'sphinx.ext.intersphinx',
]
# 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'zaza'
copyright = u'2016-2018, Canonical Ltd'
# 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'Canonical Ltd', 'manual'),
]
# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'http://docs.python.org/': None}

18
doc/source/index.rst Normal file
View File

@@ -0,0 +1,18 @@
.. zaza documentation master file.
Welcome to zaza's documentation!
=================================
Contents:
.. toctree::
:maxdepth: 2
api
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

46
setup.cfg Normal file
View File

@@ -0,0 +1,46 @@
[metadata]
name = zaza
summary = Provides test automation for Openstack Charms
version = 0.0.2.dev1
description-file =
README.rst
author = Chris MacNaughton and others (see CONTRIBUTORS.rst)
author-email = chris.macnaughton@canonical.com
url = https://github.com/openstack-charmers/zaza
classifier =
Development Status :: 2 - Pre-Alpha
Intended Audience :: Developers
Topic :: System
Topic :: System :: Installation/Setup
opic :: System :: Software Distribution
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
License :: OSI Approved :: Apache Software License
[build_sphinx]
source-dir = doc/source
build-dir = doc/build
all_files = 1
[upload_sphinx]
upload-dir = doc/build/html
[compile_catalog]
directory = zaza/locale
domain = zaza
[update_catalog]
domain = zaza
output_dir = zaza/locale
input_file = zaza/locale/zaza.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = zaza/locale/zaza.pot
[nosetests]
nologcapture=1

View File

@@ -62,21 +62,6 @@ if sys.argv[-1] == 'tag':
setup(
name='zaza',
version=version,
description='Provides test automation for Openstack Charms',
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"Topic :: System",
"Topic :: System :: Installation/Setup",
"Topic :: System :: Software Distribution",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"License :: OSI Approved :: Apache Software License",
],
entry_points={
'console_scripts': [
'functest-run-suite = zaza.charm_lifecycle.func_test_runner:main',
@@ -89,9 +74,6 @@ setup(
'tempest-config = zaza.tempest_config:main',
]
},
url='https://github.com/openstack-charmers/zaza',
author='Chris MacNaughton',
author_email='chris.macnaughton@canonical.com',
license='Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0',
packages=find_packages(exclude=["unit_tests"]),
zip_safe=False,

View File

@@ -23,3 +23,11 @@ commands = {posargs}
[flake8]
ignore = E402,E226
[testenv:docs]
basepython = python3
changedir = doc/source
deps =
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc-requirements.txt
commands = sphinx-build -W -b html -d {toxinidir}/doc/build/doctrees . {toxinidir}/doc/build/html

View File

@@ -29,14 +29,17 @@ def generate_cert(common_name,
signing_key=None,
signing_key_password=None,
generate_ca=False):
"""
Generate x.509 certificate
"""Generate x.509 certificate
Example of how to create a certificate chain:
(cakey, cacert) = generate_cert('DivineAuthority', generate_ca=True)
(crkey, crcert) = generate_cert('test.com',
issuer_name='DivineAuthority',
signing_key=cakey)
Example of how to create a certificate chain::
(cakey, cacert) = generate_cert(
'DivineAuthority',
generate_ca=True)
(crkey, crcert) = generate_cert(
'test.com',
issuer_name='DivineAuthority',
signing_key=cakey)
:param common_name: Common Name to use in generated certificate
:type common_name: str