2007-07-23 09:02:25 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
"""
|
|
|
|
|
Sphinx
|
|
|
|
|
~~~~~~
|
|
|
|
|
|
2008-01-16 20:27:25 +00:00
|
|
|
The Sphinx documentation toolchain.
|
2007-07-23 09:02:25 +00:00
|
|
|
|
2018-01-01 01:06:58 +09:00
|
|
|
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
|
2008-12-27 12:19:17 +01:00
|
|
|
:license: BSD, see LICENSE for details.
|
2007-07-23 09:02:25 +00:00
|
|
|
"""
|
|
|
|
|
|
2010-07-28 19:58:17 +02:00
|
|
|
# Keep this file executable as-is in Python 3!
|
|
|
|
|
# (Otherwise getting the version out of it from setup.py is impossible.)
|
|
|
|
|
|
2016-12-04 17:52:45 +09:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
import warnings
|
2008-11-29 19:56:58 +01:00
|
|
|
from os import path
|
2007-07-23 09:02:25 +00:00
|
|
|
|
2017-09-21 10:28:44 +01:00
|
|
|
from .cmd import build
|
2016-12-04 17:52:45 +09:00
|
|
|
from .deprecation import RemovedInNextVersionWarning
|
2017-09-21 10:28:44 +01:00
|
|
|
from .deprecation import RemovedInSphinx20Warning
|
2017-03-03 12:19:09 +09:00
|
|
|
|
2016-12-04 17:52:45 +09:00
|
|
|
# by default, all DeprecationWarning under sphinx package will be emit.
|
|
|
|
|
# Users can avoid this by using environment variable: PYTHONWARNINGS=
|
|
|
|
|
if 'PYTHONWARNINGS' not in os.environ:
|
|
|
|
|
warnings.filterwarnings('default',
|
|
|
|
|
category=RemovedInNextVersionWarning, module='sphinx')
|
|
|
|
|
# docutils.io using mode='rU' for open
|
|
|
|
|
warnings.filterwarnings('ignore', "'U' mode is deprecated",
|
|
|
|
|
DeprecationWarning, module='docutils.io')
|
|
|
|
|
|
2018-01-20 19:48:11 +09:00
|
|
|
__version__ = '1.8.0+'
|
|
|
|
|
__released__ = '1.8.0' # used when Sphinx builds its own docs
|
2015-03-14 16:46:24 +09:00
|
|
|
|
2017-10-22 14:59:09 +01:00
|
|
|
#: Version info for better programmatic use.
|
|
|
|
|
#:
|
|
|
|
|
#: A tuple of five elements; for Sphinx version 1.2.1 beta 3 this would be
|
|
|
|
|
#: ``(1, 2, 1, 'beta', 3)``. The fourth element can be one of: ``alpha``,
|
|
|
|
|
#: ``beta``, ``rc``, ``final``. ``final`` always has 0 as the last element.
|
|
|
|
|
#:
|
|
|
|
|
#: .. versionadded:: 1.2
|
|
|
|
|
#: Before version 1.2, check the string ``sphinx.__version__``.
|
2018-01-20 19:48:11 +09:00
|
|
|
version_info = (1, 8, 0, 'beta', 0)
|
2008-01-21 20:20:37 +00:00
|
|
|
|
2008-11-29 19:56:58 +01:00
|
|
|
package_dir = path.abspath(path.dirname(__file__))
|
|
|
|
|
|
2015-03-14 16:46:24 +09:00
|
|
|
__display_version__ = __version__ # used for command line version
|
|
|
|
|
if __version__.endswith('+'):
|
2016-12-27 22:01:48 +01:00
|
|
|
# try to find out the commit hash if checked out from git, and append
|
2009-08-04 23:29:05 +02:00
|
|
|
# it to __version__ (since we use this value from setup.py, it gets
|
|
|
|
|
# automatically propagated to an installed copy as well)
|
2015-03-14 16:46:24 +09:00
|
|
|
__display_version__ = __version__
|
|
|
|
|
__version__ = __version__[:-1] # remove '+' for PEP-440 version spec.
|
2009-08-04 23:29:05 +02:00
|
|
|
try:
|
|
|
|
|
import subprocess
|
2015-02-25 00:17:41 +09:00
|
|
|
p = subprocess.Popen(['git', 'show', '-s', '--pretty=format:%h',
|
2009-08-04 23:29:05 +02:00
|
|
|
path.join(package_dir, '..')],
|
|
|
|
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
|
|
out, err = p.communicate()
|
|
|
|
|
if out:
|
2017-05-07 14:09:54 +09:00
|
|
|
__display_version__ += '/' + out.decode().strip()
|
2009-08-04 23:29:05 +02:00
|
|
|
except Exception:
|
|
|
|
|
pass
|
|
|
|
|
|
2008-01-21 20:20:37 +00:00
|
|
|
|
2017-09-21 10:28:44 +01:00
|
|
|
def main(*args, **kwargs):
|
|
|
|
|
warnings.warn(
|
|
|
|
|
'`sphinx.main()` has moved to `sphinx.cmd.build.main()`.',
|
|
|
|
|
RemovedInSphinx20Warning,
|
|
|
|
|
stacklevel=2,
|
|
|
|
|
)
|
2017-10-17 14:15:00 +02:00
|
|
|
return build.main(*args, **kwargs)
|
2014-01-11 19:36:05 +01:00
|
|
|
|
|
|
|
|
|
2007-07-23 09:02:25 +00:00
|
|
|
if __name__ == '__main__':
|
2017-09-21 10:28:44 +01:00
|
|
|
warnings.warn(
|
|
|
|
|
'`sphinx` has moved to `sphinx.build`.',
|
|
|
|
|
RemovedInSphinx20Warning,
|
|
|
|
|
stacklevel=2,
|
|
|
|
|
)
|
|
|
|
|
build.main()
|