mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Adjust interface to sphinx.cmd.build with 1.7's
This commit is contained in:
parent
d277a01242
commit
13bb072e7c
@ -18,7 +18,6 @@ import os
|
||||
import warnings
|
||||
from os import path
|
||||
|
||||
from .cmd import build
|
||||
from .deprecation import RemovedInNextVersionWarning
|
||||
from .deprecation import RemovedInSphinx20Warning
|
||||
|
||||
@ -77,6 +76,7 @@ def main(*args, **kwargs):
|
||||
RemovedInSphinx20Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
from .cmd import build
|
||||
return build.main(*args, **kwargs)
|
||||
|
||||
|
||||
@ -86,4 +86,5 @@ if __name__ == '__main__':
|
||||
RemovedInSphinx20Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
from .cmd import build
|
||||
build.main()
|
||||
|
@ -1,9 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
sphinx.cmdline
|
||||
~~~~~~~~~~~~~~
|
||||
sphinx.cmd.build
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
sphinx-build command-line handling.
|
||||
Build documentation from a provided source.
|
||||
|
||||
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
|
||||
:license: BSD, see LICENSE for details.
|
||||
@ -194,8 +194,16 @@ files can be built by specifying individual filenames.
|
||||
return parser
|
||||
|
||||
|
||||
def main(argv=sys.argv[1:]): # type: ignore
|
||||
def make_main(argv=sys.argv[1:]): # type: ignore
|
||||
# type: (List[unicode]) -> int
|
||||
"""Sphinx build "make mode" entry."""
|
||||
from sphinx import make_mode
|
||||
return make_mode.run_make_mode(argv[1:]) # type: ignore
|
||||
|
||||
|
||||
def build_main(argv=sys.argv[1:]): # type: ignore
|
||||
# type: (List[unicode]) -> int
|
||||
"""Sphinx build "main" command-line entry."""
|
||||
|
||||
parser = get_parser()
|
||||
args = parser.parse_args(argv)
|
||||
@ -292,3 +300,15 @@ def main(argv=sys.argv[1:]): # type: ignore
|
||||
except (Exception, KeyboardInterrupt) as exc:
|
||||
handle_exception(app, args, exc, error)
|
||||
return 2
|
||||
|
||||
|
||||
def main(argv=sys.argv[1:]): # type: ignore
|
||||
# type: (List[unicode]) -> int
|
||||
if sys.argv[1:2] == ['-M']:
|
||||
return make_main(argv)
|
||||
else:
|
||||
return build_main(argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
|
Loading…
Reference in New Issue
Block a user