summaryrefslogtreecommitdiff
path: root/sphinx/apidoc.py
blob: f397631fb1e40c05cbca0da8c434a7a6d431baf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
"""
    sphinx.apidoc
    ~~~~~~~~~~~~~

    This file has moved to :py:mod:`sphinx.ext.apidoc`.

    :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import warnings

from sphinx.deprecation import RemovedInSphinx20Warning
from sphinx.ext.apidoc import main as _main


if False:
    # For type annotation
    from typing import Any  # NOQA
    from sphinx.application import Sphinx  # NOQA


def main(*args, **kwargs):
    # type: (Any, Any) -> None
    warnings.warn(
        '`sphinx.apidoc.main()` has moved to `sphinx.ext.apidoc.main()`.',
        RemovedInSphinx20Warning,
        stacklevel=2,
    )
    args = args[1:]  # skip first argument to adjust arguments (refs: #4615)
    _main(*args, **kwargs)


# So program can be started with "python -m sphinx.apidoc ..."
if __name__ == "__main__":
    warnings.warn(
        '`sphinx.apidoc` has moved to `sphinx.ext.apidoc`.',
        RemovedInSphinx20Warning,
        stacklevel=2,
    )
    main()