Set sensible defaults for sphinx locations.
Change-Id: Ic069ec2f7598617c8a50fe401fbbdf50ec8e4443
This commit is contained in:
parent
35b51bf28e
commit
722e1be062
|
@ -166,6 +166,14 @@ exclude .gitreview
|
|||
autoindex.write(" %s.rst\n" % module)
|
||||
|
||||
def run(self):
|
||||
# Fix up defaults for option dicts
|
||||
build_doc = self.distribution.get_option_dict('build_sphinx')
|
||||
if 'source_dir' not in build_doc:
|
||||
build_doc['source_dir'] = ('pbr', 'doc/source')
|
||||
if 'build_dir' not in build_doc:
|
||||
build_doc['build_dir'] = ('pbr', 'doc/build')
|
||||
build_doc['all_files'] = ('pbr', True)
|
||||
self.distribution.command_options['build_sphinx'] = build_doc
|
||||
if not os.getenv('SPHINX_DEBUG'):
|
||||
self.generate_autoindex()
|
||||
|
||||
|
@ -180,4 +188,22 @@ exclude .gitreview
|
|||
except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
from setuptools.command.upload_docs import upload_docs
|
||||
|
||||
class LocalUploadDocs(upload_docs):
|
||||
def run(self):
|
||||
build_dict = self.distribution.get_option_dict('build_sphinx')
|
||||
if 'build_dir' in build_dict:
|
||||
html_dir = os.path.join(build_dict['build_dir'][1], 'html')
|
||||
else:
|
||||
html_dir = 'doc/build/html'
|
||||
upload_doc = self.distribution.get_option_dict('upload_docs')
|
||||
upload_doc['upload_dir'] = ('pbr', html_dir)
|
||||
self.distribution.command_options['upload_docs'] = upload_doc
|
||||
upload_docs.run(self)
|
||||
cmdclass['upload_docs'] = LocalUploadDocs
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
return cmdclass
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2012 OpenStack LLC
|
||||
#
|
||||
# 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.
|
Loading…
Reference in New Issue