mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-12 08:30:20 +00:00
docs: support building a subset of the documentation with build_docs
Closes IDF-1688
This commit is contained in:
@@ -84,6 +84,8 @@ def main():
|
||||
help="Parallel Sphinx builds - number of independent Sphinx builds to run", default="auto")
|
||||
parser.add_argument("--sphinx-parallel-jobs", "-j", choices=["auto"] + [str(x) for x in range(8)],
|
||||
help="Sphinx parallel jobs argument - number of threads for each Sphinx build to use", default="1")
|
||||
parser.add_argument("--input-docs", "-i", nargs='+', default=[""],
|
||||
help="List of documents to build relative to the doc base folder, i.e. the language folder. Defaults to all documents")
|
||||
|
||||
action_parsers = parser.add_subparsers(dest='action')
|
||||
|
||||
@@ -153,7 +155,7 @@ def parallel_call(args, callback):
|
||||
for target in targets:
|
||||
for language in languages:
|
||||
build_dir = os.path.realpath(os.path.join(args.build_dir, language, target))
|
||||
entries.append((language, target, build_dir, args.sphinx_parallel_jobs, args.builders))
|
||||
entries.append((language, target, build_dir, args.sphinx_parallel_jobs, args.builders, args.input_docs))
|
||||
|
||||
print(entries)
|
||||
errcodes = pool.map(callback, entries)
|
||||
@@ -175,7 +177,7 @@ def parallel_call(args, callback):
|
||||
return 0
|
||||
|
||||
|
||||
def sphinx_call(language, target, build_dir, sphinx_parallel_jobs, buildername):
|
||||
def sphinx_call(language, target, build_dir, sphinx_parallel_jobs, buildername, input_docs):
|
||||
# Note: because this runs in a multiprocessing Process, everything which happens here should be isolated to a single process
|
||||
# (ie it doesn't matter if Sphinx is using global variables, as they're it's own copy of the global variables)
|
||||
|
||||
@@ -201,6 +203,7 @@ def sphinx_call(language, target, build_dir, sphinx_parallel_jobs, buildername):
|
||||
"-w", SPHINX_WARN_LOG,
|
||||
"-t", target,
|
||||
"-D", "idf_target={}".format(target),
|
||||
"-D", "docs_to_build={}".format(",". join(input_docs)),
|
||||
os.path.join(os.path.abspath(os.path.dirname(__file__)), language), # srcdir for this language
|
||||
os.path.join(build_dir, buildername) # build directory
|
||||
]
|
||||
@@ -259,9 +262,9 @@ def action_build(args):
|
||||
|
||||
|
||||
def call_build_docs(entry):
|
||||
(language, target, build_dir, sphinx_parallel_jobs, builders) = entry
|
||||
(language, target, build_dir, sphinx_parallel_jobs, builders, input_docs) = entry
|
||||
for buildername in builders:
|
||||
ret = sphinx_call(language, target, build_dir, sphinx_parallel_jobs, buildername)
|
||||
ret = sphinx_call(language, target, build_dir, sphinx_parallel_jobs, buildername, input_docs)
|
||||
if ret != 0:
|
||||
return ret
|
||||
|
||||
|
||||
Reference in New Issue
Block a user