|
|
@@ -14,30 +14,21 @@
|
|
|
|
|
|
import sys
|
|
|
import os
|
|
|
+import re
|
|
|
+from subprocess import call, Popen, PIPE
|
|
|
+import shlex
|
|
|
|
|
|
# If extensions (or modules to document with autodoc) are in another directory,
|
|
|
# add these directories to sys.path here. If the directory is relative to the
|
|
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
|
-#sys.path.insert(0, os.path.abspath('.'))
|
|
|
+sys.path.insert(0, os.path.abspath('.'))
|
|
|
|
|
|
+from repo_util import run_cmd_get_output
|
|
|
# -- Run DoxyGen to prepare XML for Sphinx---------------------------------
|
|
|
# ref. https://github.com/rtfd/readthedocs.org/issues/388
|
|
|
|
|
|
-from subprocess import call, Popen, PIPE
|
|
|
-import shlex
|
|
|
-
|
|
|
call('doxygen')
|
|
|
|
|
|
-# -- Function to get output of a command ----------------------------------
|
|
|
-def run_cmd_get_output(cmd):
|
|
|
- process = Popen(shlex.split(cmd), stdout=PIPE)
|
|
|
- (output, err) = process.communicate()
|
|
|
- exit_code = process.wait()
|
|
|
- if exit_code != 0:
|
|
|
- raise RuntimeError('command line program has failed')
|
|
|
- return output
|
|
|
-
|
|
|
-
|
|
|
# -- General configuration ------------------------------------------------
|
|
|
|
|
|
# If your documentation needs a minimal Sphinx version, state it here.
|
|
|
@@ -46,7 +37,7 @@ def run_cmd_get_output(cmd):
|
|
|
# Add any Sphinx extension module names here, as strings. They can be
|
|
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
|
# ones.
|
|
|
-extensions = ['breathe']
|
|
|
+extensions = ['breathe', 'link-roles']
|
|
|
|
|
|
# Breathe extension variables
|
|
|
breathe_projects = { "esp32-idf": "xml/" }
|
|
|
@@ -73,22 +64,17 @@ copyright = u'2016 - 2017, Espressif'
|
|
|
# built documents.
|
|
|
#
|
|
|
|
|
|
-# Different setup depending if script is running on ReadTheDocs or elsewhere
|
|
|
-on_rtd = os.environ.get('READTHEDOCS') == 'True'
|
|
|
-if on_rtd:
|
|
|
- # The short X.Y version.
|
|
|
- # Apparently ReadTheDocs is getting confused by other version / release
|
|
|
- # ReadTheDocs is building specific or the latest release from GitHub.
|
|
|
- version = '1.0'
|
|
|
- release = '1.0'
|
|
|
-else:
|
|
|
- # This is supposed to be "the short X.Y version", but it's the only version
|
|
|
- # visible when you open index.html.
|
|
|
- # Display full version to make things less confusing.
|
|
|
- # If needed, nearest tag is returned by 'git describe --abbrev=0'.
|
|
|
- version = run_cmd_get_output('git describe')
|
|
|
- # The full version, including alpha/beta/rc tags.
|
|
|
- release = run_cmd_get_output('git describe')
|
|
|
+# Readthedocs largely ignores 'version' and 'release', and displays one of
|
|
|
+# 'latest', tag name, or branch name, depending on the build type.
|
|
|
+# Still, this is useful for non-RTD builds.
|
|
|
+# This is supposed to be "the short X.Y version", but it's the only version
|
|
|
+# visible when you open index.html.
|
|
|
+# Display full version to make things less confusing.
|
|
|
+version = run_cmd_get_output('git describe')
|
|
|
+# The full version, including alpha/beta/rc tags.
|
|
|
+# If needed, nearest tag is returned by 'git describe --abbrev=0'.
|
|
|
+release = version
|
|
|
+print 'Version: {0} Release: {1}'.format(version, release)
|
|
|
|
|
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
|
# for a list of supported languages.
|