Commit Graph

29 Commits

Author SHA1 Message Date
Clark Boylan 47c5afe79a Remove sphinx doc building integration
Setuptools and sphinx [0] have removed support for building docs through
setup.py. This has broken imports which break our own local doc builds.
Lets just remove it all (including the tests) so that we are compatible
with modern setuptools and sphinx.

An alternative approach would be to do conditional imports and continue
to support this for old setuptools and sphinx. But that feels like a
dead end that will be difficult to test. Probably better to rip this
bandaid off.

[0] https://www.sphinx-doc.org/en/master/changes.html#id7

Change-Id: I65038caceb192f495288414079ca0f07ce6318bb
2023-05-31 13:25:13 -07:00
Stephen Finucane 57d7c53739 Update to latest hacking
Change-Id: If73238a39d0934c6f577fc52132fcbc63e8eb25f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-08-27 16:57:23 +01:00
Stephen Finucane ecbda3076e Deprecate 'build_sphinx' integration
We now have a path away from this feature, so let's deprecate it while
we can.

Change-Id: Idfc34b9085c6da9b8cac24986be5f3bad142d927
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2018-07-18 15:23:44 +01:00
Ian Wienand a562b12446 Fix builddoc with sphinx <= 1.6
I went to build infra-specs which specifies sphinx==1.5.6 and hit

 Traceback (most recent call last):
   File "setup.py", line 29, in <module>
     pbr=True)
   ...
  File ".../pbr/builddoc.py", line 235, in run
    self._sphinx_run()
  File ".../pbr/builddoc.py", line 162, in _sphinx_run
    freshenv=self.fresh_env, warningiserror=self.warning_is_error)
  File ".../sphinx/application.py", line 244, in __init__
    self._init_builder(self.buildername)
  File "...//sphinx/application.py", line 311, in _init_builder
    raise SphinxError('Builder name %s not registered' % buildername)
 sphinx.errors.SphinxError: Builder name h not registered

It appears to be a typo introduced with
I18bbf693bca2f6e49d822ae2940d2170a2b90ce9; make sure we're walking the
self.builders list; not the string self.builder.

Change-Id: Ic038029c361b3ede48f2b495c74430d3ad1eab82
2018-04-24 14:27:40 +10:00
Stephen Finucane 1fe0ceab39 builddoc: Treat '[pbr] autodoc_tree_excludes' as a multi-line opt
We were treating this a single line, comma- or space-delimited option.
This was incorrect and was causing issues for projects like neutron-lib
when Sphinx 1.7, which switches from optparse to the stricter argparse
was used. In addition, this project was including comments in the
multi-line opt. These were being passed through but Sphinx < 1.7 was
simply ignoring them. These are now filtered out.

Change-Id: I177edf0f44714175da220cf3a960b8f23aa4ab09
Closes-Bug: #1753082
2018-03-26 12:40:20 +00:00
Doug Hellmann 8aaf237382 future-proof invocation of apidoc
Newer versions of Sphinx have moved the apidoc module into sphinx.ext
and the API is slightly different (the function expects sys.argv[1:]
instead of sys.argv[:]. So, figure out where we can import it from and
set a flag so we can invoke it properly. See this change in sphinx for
details:
87630c8ae8

Change-Id: I8235968f8a474c9e6088d935d0868570b2917c07
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-01-17 15:34:07 -05:00
Doug Hellmann ea3e5ab403 emit warning correctly
distutils.log has a warn() function but not a warning() function.

Change-Id: Iebfdb9e4d062d188ef9c73b66007a70f9c289ed2
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-01-17 15:34:07 -05:00
Stephen Finucane cc703f4926 Deprecate support for Sphinx < 1.6
We don't want to support older versions of Sphinx forever. While
OpenStack's global requirements have been bumped to Sphinx 1.6, there
are non-OpenStack users in the wild. Give them a chance to upgrade to
the newer version before we completely remove support.

This also gives us a chance to deprecate the '[sphinx_build] builders'
setuptools option, which is no longer necessary with Sphinx 1.6+. Do
this. The documentation is updated to reflect this (and some references
to a "custom" 'source_dir' option removed, as it's not at all specific
to pbr).

Change-Id: I18bbf693bca2f6e49d822ae2940d2170a2b90ce9
Related-Bug: #1702872
2017-09-25 16:22:48 +01:00
Stephen Finucane c59fad9c88 builddoc: Use '[sphinx_build] builders' with Sphinx < 1.6
In 'c024066', we resolved an issue with pbr and Sphinx 1.6+ and
implicitly started using Sphinx 1.6's support for declaring multiple
builders as part of the setuptools plugin. However, in doing so, we
neglected to provide a migration path for folks who were using the older
option. This meant folks using the '[sphinx_build] builders' option
would see a breaking change in behavior when upgrading to a pbr release
including the above change. Resolve this issue now.

Note that we want to deprecate support for this option in the future,
but doing so is not a backportable change and will be done separately.

Change-Id: Ic2fe67f932ba26b665110ae66431a5359fc50016
Closes-Bug: #1702872
Related-Bug: #1691129
2017-09-25 16:22:42 +01:00
Doug Hellmann 3c059cb701 allow user to override the output location of api docs
Allow the user to specify 'api_doc_dir' in the build_sphinx section of
their setup.cfg to control where the auto-generated API documentation is
written.

Change-Id: I2bd5652bb59cbd9c939931ba2e7db1b37d2b30bb
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-15 12:41:49 -04:00
Julien Danjou c02406601a builddoc: uses the new Sphinx 1.6 code for multiple builder
As noted by stephenfin, Sphinx 1.6 provides its own code to build doc with
multiple builders. The one provided by pbr so far for Sphinx < 1.6 is not even
compatible with 1.6. This patch fixes that by running the native Sphinx code
for Sphinx > 1.6 and falling back to the old code for older Sphinx versions.

Closes-Bug: #1691129
Change-Id: I5224235b1056a248b246c54e2d99eea94d53c4eb
2017-05-17 12:11:18 +02:00
Stephen Finucane 0469bf39d4 trivial: Add note about multiple builders support
Sphinx 1.6 will support the definition of multiple builders in a
setup.cfg file like so:

  [build_sphinx]
  builder = html man

Once we support this version of Sphinx, we should stop carrying the
custom versions of this tooling we use.

Upstreaming things FTW.

Change-Id: Ibf2a003229a4585df96b09da7ca547e201c5aef5
2017-04-18 10:36:09 +01:00
Jenkins ca6e92c723 Merge "Stop building man pages by default" 2017-04-15 15:00:46 +00:00
Stephen Finucane 1ed8531095 Remove 'build_sphinx_latex'
codesearch.o.o shows a single, long-dead project using this [1]. Let's
just remove it and push people to set 'builders' instead in they really
want LaTeX.

[1] http://codesearch.openstack.org/?q=build_sphinx_latex

Change-Id: I820d9c540ae81717d7b33bbb4d2a4031b529b52c
2017-04-14 18:05:42 +00:00
Stephen Finucane d4e4efd779 Stop building man pages by default
From pretty much the beginning [1], pbr has defaulted to building both
man page and html output, but has failed to document it anywhere. People
tend to copy-paste their 'setup.py' and 'conf.py', or rely on the
'cookiecutter' project, with very little understanding of what's going
on under the hood (and why would you care - it's docs :)). This means
that the vast majority of folks using 'pbr' (basically everyone in
OpenStack) have been unwittingly building "man pages" as part of their
doc builds for no good reason, which has also led to a lot of confusion
when this magic behavior is the cause of bugs [2][3].

There's no good reason that pbr should default to building both man
pages and html output. For folks that want this functionality, we should
document it so they can use it. For everyone else though, let's do the
sane thing and output html like the standard 'build_sphinx' plugin.

[1] https://github.com/openstack-dev/pbr/commit/5b8b7f1d
[2] https://bugs.launchpad.net/pbr/+bug/1681983
[3] https://bugs.launchpad.net/oslotest/+bug/1379998

Change-Id: I579134a2b7980669180c1666503b848835cc2957
Closes-Bug: #1681983
2017-04-14 18:05:22 +00:00
Doug Hellmann 84a8599133 add image.nonlocal_uri to the list of warnings ignored
pbr currently hard-codes the list of warnings that are to be ignored.
Many OpenStack projects use remote images to add project "badges" based
on tags defined in the governance repository. Ignore the warning caused
by using remote images so we can unbreak documentation builds using
those badges.

Change-Id: If47e3ca6519cc9f70d62cd887707321fe9199f81
Addresses-Bug: #1682467
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-04-13 11:51:55 -04:00
Alfredo Moralejo 2d7c0045f4 Initialize sphinx config using application instead of config
Currently sphinx config is initialized using sphinx.config,
however in recent versions of Sphinx, plugin specific parameters
as man_pages for man builder has been moved to the extension
and is not initialized from sphinx.config but using sphinx.application.
This is making man_pages to be empty when using sphinx 1.5 and man
builder is not properly called.

This patch initializes sphinx config using sphinx.application which
works fine with both old and new Sphinx versions.

Closes-Bug: #1674795

Depends-On: I7bde8fc1f2a7db5bd73635aa197377bf5ac614d2
Change-Id: Ib7c1a6fe8fbb5acfcfcfac61d0b53f080ff2b1e4
2017-03-27 08:46:47 +00:00
Stephen Finucane 72e8e42a34 Stop using 'warnerrors'
This legacy option provided the ability to fail on doc warnings.
However, this functionality is broken in recent releases and now exists
in Sphinx itself (since 1.5.0). Rather that fixing it and causing a
whole load of doc build errors introduced in the time since this option
was broken, remove it, preferring the new Sphinx option instead.

This allows us to remove a lot of test code which is essentially testing
Sphinx functionality only now, based on the assumption that Sphinx do
adequate testing themselves.

Change-Id: Ia4b6adefcd437cb1ceb4558b004c17359df2486d
2017-02-27 14:20:57 +00:00
Dirk Mueller 9fd7aa2cc7 Don't raise exception on missing man pages
The revert in Ia6cfbfe5b10a5b714fbb9f21ca61380aaf231638 actually
broke Sphinx 1.3.x support again. Try to fix it for real this
time by avoiding an exception on missing man_pages.

NOTE(dmllr): don't change dict while iterating over it, hopefully
this fixes the gating failure with python 3.5.x

Change-Id: I52d45fa0a0d42de690d3a492068f7bb03483a224
Related-Bug: 1379998
2017-01-02 23:08:30 +01:00
dineshbhor a95982f9a0 Replace OpenStack LLC with OpenStack Foundation
Change-Id: I03fac862d7346bdac83503afb5f26119d0ea300d
Closes-Bug: #1214176
2016-07-26 17:37:42 +05:30
Sachi King 9a5a9052ac Restore warnerrors behavior and support Sphinx 1.4
Pass the flag to tell Sphinx to treat warnings as errors.

Add compatability note for versions 1.4.0 and suppress
re-register warnings on subsequent runs.

Change-Id: I680b448471e687919d202e8f2abe57f8ba3b22ee
Closes-Bug: #1496882
Co-Authored-By: Doug Hellmann <doug@doughellmann.com>
2016-06-18 11:18:38 +10:00
Ian Y. Choi a5d46d5ce7 More support Sphinx >=1.3b1 and <1.3.1
Although https://review.openstack.org/#/c/171309/
says Sphinx >=1.3, the actual implementation does not
support Sphinx >=1.3b1 and 1.3.1.
I have seen Sphinx release notes and source codes for
those versions, and found that up to 1.2.3 used
init_values(self) and Sphinx from 1.3b1 used
init_values(self, warn).

So to change the code from >=1.3.1 to >1.2.3, it can
more support Sphinx >=1.3b1 and <1.3.1.

Change-Id: Ia73be8111d3af7f72aaf640e4c7c519a5d0b08c5
Partial-Bug: #1379998
Related-Bug: #1496882
2015-11-09 21:14:47 +09:00
Timothy Chavez e19572e2d1 Support Sphinx >=1.3 new protoype and warnings
Sphinx >= 1.3 changes:
- Prototypes for init_values() requires a handle to warnings.warn
- New warning for setting the html_theme in conf.py to 'default':
   sphinx.errors.SphinxWarning: WARNING: 'default' html theme has been
   renamed to 'classic'. Please change your html_theme setting either
   to the new 'alabaster' default theme, or to 'classic' to keep using
   the old default.

This change deals with the above sphinx updates by adding the handle to
init_values() and setting pbr to _not_ fail on warnings when building the
docs.

Change-Id: Iba92628263e20efca84aeada0e19000f4c9b1fac
2015-08-10 12:39:39 -07:00
Paul Belanger e41a9180ed Revert "Remove sphinx_config.init_values() manual call"
This caused in issue in the gate for tox -edocs builds:

   http://logs.openstack.org/15/187715/5/check/gate-infra-specs-docs/a8cae26/console.html

This reverts commit 1dfe9ef348.

Change-Id: Ia6cfbfe5b10a5b714fbb9f21ca61380aaf231638
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-06-09 14:35:55 -04:00
Jenkins dceb9e56dd Merge "builddoc: allow to use fnmatch-style exclusion for autodoc" 2015-06-07 04:06:15 +00:00
Thomas Bechtold 1dfe9ef348 Remove sphinx_config.init_values() manual call
The function signature for Sphinx's config.init_values() changed since
version 1.3. That leads to:

TypeError: init_values() takes exactly 2 arguments (1 given)

But the function is already correctly called from
application.Sphinx()'s constructor. So use the configuration object
from the application instead of creating an own config object.

Change-Id: I343c26560bfe5116d5348b50b1890b3442ed845a
Closes-Bug: #1379998
2015-06-02 18:40:38 +02:00
Julien Danjou e943f76085 builddoc: allow to use fnmatch-style exclusion for autodoc
This allows to use patterns such as heat.tests.* to exlude modules from
autodoc genereation.

Change-Id: Ibfc4161670fd9344da88c4a85a3aea992fcdf519
2015-05-21 15:00:47 -07:00
Darragh Bailey 702042e796 Allow overwriting sphinx builder from command line
The build_sphinx setuptools command supports selection of a builder.
Support the behaviour of being able to explicitely select any builder
available to sphinx via "python setup.py build_sphinx -b linkcheck", not
just one of the builders specified in the configuration file.

Change-Id: I4c7ddcaf413e1bcc72550b3d920f8a777a710c97
2015-03-04 19:03:38 +00:00
Monty Taylor c01b8dae1e Port in git sha changes from 0.10 line
Stop including git sha in version strings

We include it in pbr.json now. Including it is contentious in the world
of python, and it's up for debate as to whether or not it provides value.

Write and read more complex git sha info

Instead of encoding the git sha into the version string, add it to
a metadata file. This will allow us to get out of the business of
arguing with pip and setuptools about version info. In order to make
this really nice, provide a command line utility called "pbr" that has
subcommands to print out the metadata that we're now including in the
egg-info dir.

Only import sphinx during hook processing

When pbr is imported to handle writing the egg_info file because of
the entry point, it's causing sphinx to get imported. This has a
cascading effect once docutils is trying to be installed on a system
with pbr installed. If some of the imports fail along the way, allow
pbr to continue usefully but without the Sphinx extensions
available. Eventually, when everything is installed, those
extensions will work again when the commands for build_sphinx, etc.
are run separately.

Also slip in a change to reorder the default list of environments
run by tox so the testr database is created using a dbm format
available to all python versions.

Integration test PBR commits

Make sure that if a PBR commit is being tested then we install and
use that source rather than the latest PBR release.

Change-Id: Ie121e795be2eef30822daaa5fe8ab1c2315577ae
(cherry picked from commit 65f4fafd90)
(cherry picked from commit cd7da23937)
Closes-Bug: #1403510
Co-Authored-By: Clark Boylan <clark.boylan@gmail.com>
Co-Authored-By: Doug Hellmann <doug@doughellmann.com>
Co-Authored-By: Jeremy Stanley <fungi@yuggoth.org>
2014-12-21 22:20:49 +00:00