PDF documentation build

Change-Id: I7db6a34ba582c048c40c450453f239ada6260ac2
This commit is contained in:
zhurong 2019-09-19 19:13:39 -07:00
parent 12377d0e9b
commit 92a0a825e5
10 changed files with 93 additions and 63 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ doc/source/api/
etc/panko/panko.conf etc/panko/panko.conf
subunit.log subunit.log
etc/panko/policy.yaml.sample etc/panko/policy.yaml.sample
doc/source/_static/

9
doc/requirements.txt Normal file
View File

@ -0,0 +1,9 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD
openstackdocstheme>=1.20.0 # Apache-2.0
sphinxcontrib-pecanwsme>=0.8.0 # Apache-2.0
sphinxcontrib-httpdomain>=1.6.1 # BSD
reno>=2.7.0 # Apache-2.0

View File

@ -11,22 +11,13 @@
# All configuration values have a default; values that are commented out # All configuration values have a default; values that are commented out
# serve to show the default. # serve to show the default.
import subprocess
import sys
import os import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))
sys.path.insert(0, ROOT)
sys.path.insert(0, BASE_DIR)
# This is required for ReadTheDocs.org, but isn't a bad idea anyway.
os.environ['DJANGO_SETTINGS_MODULE'] = 'openstack_dashboard.settings'
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath('../'))
# -- General configuration ---------------------------------------------------- # -- General configuration ----------------------------------------------------
@ -38,10 +29,8 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'openstack_dashboard.settings'
# or your custom ones. # or your custom ones.
extensions = [ extensions = [
'sphinx.ext.autodoc', 'sphinx.ext.autodoc',
'wsmeext.sphinxext',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'sphinxcontrib.pecanwsme.rest', 'sphinxcontrib.pecanwsme.rest',
'sphinxcontrib.httpdomain',
'openstackdocstheme', 'openstackdocstheme',
'oslo_policy.sphinxpolicygen' 'oslo_policy.sphinxpolicygen'
] ]
@ -122,9 +111,9 @@ html_theme = 'openstackdocs'
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
# documentation. # documentation.
html_theme_options = { #html_theme_options = {
"nosidebar": "false" # "nosidebar": "false"
} #}
# Add any paths that contain custom themes here, relative to this directory. # Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = [] #html_theme_path = []
@ -152,7 +141,7 @@ html_theme_options = {
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format. # using the given strftime format.
html_last_updated_fmt = '%Y-%m-%d %H:%M' #html_last_updated_fmt = '%Y-%m-%d %H:%M'
# If true, SmartyPants will be used to convert quotes and dashes to # If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities. # typographically correct entities.
@ -198,21 +187,25 @@ htmlhelp_basename = 'Pankodoc'
# -- Options for LaTeX output ------------------------------------------------- # -- Options for LaTeX output -------------------------------------------------
latex_elements = { latex_elements = {
# The paper size ('letterpaper' or 'a4paper'). 'makeindex': '',
#'papersize': 'letterpaper', 'printindex': '',
'preamble': r'\setcounter{tocdepth}{3}',
# The font size ('10pt', '11pt' or '12pt'). 'maxlistdepth': '10',
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
} }
# Disable usage of xindy https://bugzilla.redhat.com/show_bug.cgi?id=1643664
latex_use_xindy = False
# Disable smartquotes, they don't work in latex
smartquotes_excludes = {'builders': ['latex']}
latex_domain_indices = False
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass # (source start file, target name, title, author, documentclass
# [howto/manual]). # [howto/manual]).
latex_documents = [ latex_documents = [
('index', 'Panko.tex', u'Panko Documentation', ('index', 'doc-panko.tex', u'Panko Documentation',
u'OpenStack Foundation', 'manual'), u'OpenStack Foundation', 'manual'),
] ]

View File

@ -36,8 +36,6 @@ Overview
contributor/index contributor/index
webapi/index webapi/index
.. update index
Sample Configuration Files Sample Configuration Files
========================== ==========================
@ -46,9 +44,11 @@ Sample Configuration Files
configuration/sample_policy configuration/sample_policy
Indices and tables .. only:: html
==================
* :ref:`genindex` Indices and tables
* :ref:`modindex` ==================
* :ref:`search`
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -77,36 +77,38 @@ def set_pagination_options(sort, limit, marker, api_model):
Arguments: Arguments:
sort -- List of sorting criteria. Each sorting option has to format sort -- List of sorting criteria. Each sorting option has to format
<sort key>:<sort direction> <sort key>:<sort direction>
Valid sort keys: message_id, generated Valid sort keys: message_id, generated
(SUPPORT_SORT_KEYS in panko/event/storage/models.py) (SUPPORT_SORT_KEYS in panko/event/storage/models.py)
Valid sort directions: asc (ascending), desc (descending) Valid sort directions: asc (ascending), desc (descending)
(SUPPORT_DIRS in panko/event/storage/models.py) (SUPPORT_DIRS in panko/event/storage/models.py)
This defaults to asc if unspecified This defaults to asc if unspecified
(DEFAULT_DIR in panko/event/storage/models.py) (DEFAULT_DIR in panko/event/storage/models.py)
impl_sqlalchemy.py: impl_sqlalchemy.py:
(see _get_pagination_query) (see _get_pagination_query)
If sort list is empty, this defaults to If sort list is empty, this defaults to
['generated:asc', 'message_id:asc'] ['generated:asc', 'message_id:asc']
(DEFAULT_SORT in panko/event/storage/models.py) (DEFAULT_SORT in panko/event/storage/models.py)
limit -- Integer specifying maximum number of values to return limit -- Integer specifying maximum number of values to return
If unspecified, this defaults to If unspecified, this defaults to
pecan.request.cfg.api.default_api_return_limit pecan.request.cfg.api.default_api_return_limit
marker -- If specified, assumed to be an integer and assumed to be the
message id of the last object on the previous page of the results
api_model -- Specifies the class implementing the api model to use for
this pagination. The class is expected to provide the
following members:
SUPPORT_DIRS marker -- If specified, assumed to be an integer and assumed to be the
SUPPORT_SORT_KEYS message id of the last object on the previous page of the results
DEFAULT_DIR
DEFAULT_SORT api_model -- Specifies the class implementing the api model to use for
PRIMARY_KEY this pagination. The class is expected to provide the
following members:
SUPPORT_DIRS
SUPPORT_SORT_KEYS
DEFAULT_DIR
DEFAULT_SORT
PRIMARY_KEY
""" """
if limit and limit <= 0: if limit and limit <= 0:
raise wsme.exc.InvalidInput('limit', limit, raise wsme.exc.InvalidInput('limit', limit,

View File

@ -76,9 +76,9 @@ def get_limited_to(headers):
:param headers: HTTP headers dictionary :param headers: HTTP headers dictionary
:return: A tuple of (user, project), set to None if there's no limit on :return: A tuple of (user, project), set to None if there's no limit on
one of these. one of these.
""" """
init() init()
policy_dict = dict() policy_dict = dict()

View File

@ -16,7 +16,12 @@ import copy
import datetime import datetime
import bson.json_util import bson.json_util
from happybase.hbase import ttypes try:
from happybase.hbase.ttypes import AlreadyExists
except ImportError:
# import happybase to enable Hbase_thrift module
import happybase # noqa
from Hbase_thrift import AlreadyExists
from oslo_log import log from oslo_log import log
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import six import six
@ -232,7 +237,7 @@ def create_tables(conn, tables, column_families):
for table in tables: for table in tables:
try: try:
conn.create_table(table, column_families) conn.create_table(table, column_families)
except ttypes.AlreadyExists: except AlreadyExists:
if conn.table_prefix: if conn.table_prefix:
table = ("%(table_prefix)s" table = ("%(table_prefix)s"
"%(separator)s" "%(separator)s"

View File

@ -12,13 +12,18 @@
# under the License. # under the License.
from __future__ import with_statement from __future__ import with_statement
import os
from alembic import config as alembic_config
from alembic import context from alembic import context
from sqlalchemy import engine_from_config, pool from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig from logging.config import fileConfig
# this is the Alembic Config object, which provides # this is the Alembic Config object, which provides
# access to the values within the .ini file in use. # access to the values within the .ini file in use.
config = context.config config = alembic_config.Config(os.path.join(os.path.dirname(__file__),
'alembic.ini'))
# Interpret the config file for Python logging. # Interpret the config file for Python logging.
# This line sets up loggers basically. # This line sets up loggers basically.

View File

@ -29,3 +29,6 @@ alembic>=0.7.6,!=0.8.1,!=0.9.0
# NOTE(jd) We do not import it directly, but WSME datetime string parsing # NOTE(jd) We do not import it directly, but WSME datetime string parsing
# behaviour changes when this library is installed # behaviour changes when this library is installed
python-dateutil>=2.4.2 # BSD python-dateutil>=2.4.2 # BSD
happybase!=0.7,!=1.0.0;python_version=='2.7' # MIT
pymongo!=3.1 # Apache-2.0
elasticsearch<3.0.0 # Apache-2.0

12
tox.ini
View File

@ -54,9 +54,21 @@ commands = oslopolicy-sample-generator --config-file=etc/panko/panko-policy-gene
[testenv:docs] [testenv:docs]
basepython = python3 basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands = python setup.py build_sphinx commands = python setup.py build_sphinx
setenv = PYTHONHASHSEED=0 setenv = PYTHONHASHSEED=0
[testenv:pdf-docs]
basepython = python3
deps = {[testenv:docs]deps}
whitelist_externals =
rm
make
commands =
rm -rf doc/build/pdf
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:venv] [testenv:venv]
basepython = python3 basepython = python3
commands = {posargs} commands = {posargs}