1
# Copyright 2014 OpenStack Foundation
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
# not use this file except in compliance with the License. You may obtain
5
# a copy of the License at
7
# http://www.apache.org/licenses/LICENSE-2.0
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
# License for the specific language governing permissions and limitations
15
# NOTE(blk-u): Uncomment the [pbr] section in setup.cfg and remove this
16
# Sphinx extension when https://launchpad.net/bugs/1260495 is fixed.
18
import os.path as path
20
from sphinx import apidoc
23
# NOTE(blk-u): pbr will run Sphinx multiple times when it generates
24
# documentation. Once for each builder. To run this extension we use the
25
# 'builder-inited' hook that fires at the beginning of a Sphinx build.
26
# We use ``run_already`` to make sure apidocs are only generated once
27
# even if Sphinx is run multiple times.
37
package_dir = path.abspath(path.join(app.srcdir, '..', '..',
39
source_dir = path.join(app.srcdir, 'api')
40
apidoc.main(['apidoc', package_dir, '-f',
41
'-H', 'keystoneclient Modules',
46
app.connect('builder-inited', run_apidoc)