docs: Set a default IDF_PATH in docs build (needed for RTD)

RTD builds don't set IDF_PATH, mqtt component uses this variable.
This commit is contained in:
Angus Gratton 2018-09-14 09:42:57 +10:00 committed by Angus Gratton
parent e6e2d7ebee
commit 44e4535c90

View File

@ -27,10 +27,17 @@ import shlex
from local_util import run_cmd_get_output, copy_if_modified from local_util import run_cmd_get_output, copy_if_modified
builddir = '_build'
builddir = builddir try:
if 'BUILDDIR' in os.environ:
builddir = os.environ['BUILDDIR'] builddir = os.environ['BUILDDIR']
except KeyError:
builddir = '_build'
# Fill in a default IDF_PATH if it's missing (ie when Read The Docs is building the docs)
try:
idf_path = os.environ['IDF_PATH']
except KeyError:
idf_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))
def call_with_python(cmd): def call_with_python(cmd):
# using sys.executable ensures that the scripts are called with the same Python interpreter # using sys.executable ensures that the scripts are called with the same Python interpreter
@ -62,6 +69,7 @@ confgen_args = [sys.executable,
"--create-config-if-missing", "--create-config-if-missing",
"--env", "COMPONENT_KCONFIGS={}".format(kconfigs), "--env", "COMPONENT_KCONFIGS={}".format(kconfigs),
"--env", "COMPONENT_KCONFIGS_PROJBUILD={}".format(kconfig_projbuilds), "--env", "COMPONENT_KCONFIGS_PROJBUILD={}".format(kconfig_projbuilds),
"--env", "IDF_PATH={}".format(idf_path),
"--output", "docs", kconfig_inc_path + '.in' "--output", "docs", kconfig_inc_path + '.in'
] ]
subprocess.check_call(confgen_args) subprocess.check_call(confgen_args)