diff --git a/bob/devtools/scripts/dumpsphinx.py b/bob/devtools/scripts/dumpsphinx.py new file mode 100644 index 0000000000000000000000000000000000000000..61caece059c73a7922c51a83fce41fa4137547d3 --- /dev/null +++ b/bob/devtools/scripts/dumpsphinx.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + +import logging +logger = logging.getLogger(__name__) + +from sphinx.ext import intersphinx + +import click + +from . import bdt +from ..log import verbosity_option + + +@click.command(context_settings=dict( + ignore_unknown_options=True, + allow_extra_args=True, + ), + epilog=''' +Examples: + + 1. Dumps objects documented in python 3.x: + + $ bdt dumpsphinx https://docs.python.org/3/objects.inv + + + 2. Dumps objects documented in numpy: + + $ bdt dumpsphinx https://docs.scipy.org/doc/numpy/objects.inv + + + 3. Dumps objects documented in matplotlib: + + $ bdt dumpsphinx http://matplotlib.org/objects.inv +''') +@click.argument('url') +@verbosity_option() +@bdt.raise_on_error +def dumpsphinx(url): + """Dumps all the objects given an sphinx catalog/inventory URL + + This command is useful when you are struggling to do proper links from your + documentation. + """ + intersphinx.inspect_main([url]) diff --git a/conda/meta.yaml b/conda/meta.yaml index d8d3bab9bc192dc29bdac11f384fbaaf23b94dc7..21ddbc1150e197cf94089cd35f486253a8608ce3 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -39,10 +39,10 @@ requirements: - gitpython - python-gitlab - requests + - sphinx test: requires: - - sphinx - sphinx_rtd_theme imports: - {{ name }} @@ -54,6 +54,7 @@ test: - bdt changelog --help - bdt release --help - bdt visibility --help + - bdt dumpsphinx --help - sphinx-build -aEW ${PREFIX}/share/doc/{{ name }}/doc {{ project_dir }}/sphinx about: diff --git a/setup.py b/setup.py index 86d4b7a8f96c786eda75a8f03aaa9f9e40ac7e6b..103b99b713b4fd9b28a3af938305c0db41b4db39 100644 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ requires = [ 'requests', 'gitpython', 'python-gitlab', + 'sphinx', ] setup( @@ -42,6 +43,7 @@ setup( 'changelog = bob.devtools.scripts.changelog:changelog', 'lasttag = bob.devtools.scripts.lasttag:lasttag', 'visibility = bob.devtools.scripts.visibility:visibility', + 'dumpsphinx = bob.devtools.scripts.dumpsphinx:dumpsphinx', ], }, classifiers=[