From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 511364560E; Fri, 12 Jul 2024 10:58:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9039842EA9; Fri, 12 Jul 2024 10:57:34 +0200 (CEST) Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by mails.dpdk.org (Postfix) with ESMTP id 0A77842E8C for ; Fri, 12 Jul 2024 10:57:32 +0200 (CEST) Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a77c2d89af8so223291166b.2 for ; Fri, 12 Jul 2024 01:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1720774651; x=1721379451; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/xWFELw4L1rjlC5j63eKLy4lq2EKvIFqLTe8wzRETRs=; b=PA4nC6M5Xj1JGzNfNHumibojdSN6dMcAn59QxsJiQrP+IVb8I/04pGpKbRhMfoUxVn UA3LscO+oMqxAmhSR/SH6Xgig2JBGwA+qPQdKACMQPxFicZIKRUdT9x1dddz342ye2II xc3zwfQrfdF2ZQUe6SUTfLLoH0c7UiOz9JP/shjkYHDG67MGjbT7eKn3jDot1My/OkeX imWI6I5bhofJK4XfOIriU1XKyT4GQRMAuZDUW1ttlas8WGPtKyPIUH9en7x7e9RB75+M tiFkkNbaG1LjY0cKi3BkSfZXeWUktRN67Ukm6/1cgQsm2P1iM91ICYTadE/HleqP0rxg nSOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720774651; x=1721379451; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/xWFELw4L1rjlC5j63eKLy4lq2EKvIFqLTe8wzRETRs=; b=hNAzthYuXERsoh3icJ+nkc3mUJJ/piw5nwq+/9EeUDowPIpQnjpcLoEn6pF9Epc8B+ Qg4/KHCIPRi6P21e2bHab+q1VWVcmJ3BCPgIT+xl1M4pV4ykKjSUpzch9QMuPrBXR8EN FAa1hvCVRjOKBN8HVdn2pPsUbGOQZ/KdPhwOS3AaDKwThKNDDEdXFbQcI5xporFgfcbV +HE0mQUj8ZTxq037sCGFEPMMIzgjqo64SJIEc48Ol9CTaqJVa1FGaDswK5NzyrVVTTvz 26s1/egv1yve3oZwjYVGiEbjV1QGGlARqAS+/4j9GMYcmAxd0CxN91GgjLedZ052s11h 2t/A== X-Gm-Message-State: AOJu0YxxgCkwa4IouTULehXZOvt5qg5MBJtMukMqUDWwnbkK+2Vh9y9V YlPxld6GYxX+gWzD2yHf+AP4uKn/9GOoN6gPACFjrT5tenG+mvHeIGjVRsS1RLo= X-Google-Smtp-Source: AGHT+IGAfckqltrsA7OMQsVY0gIKZS8dWZebD2Hdil7d/p9EPtmupQTqrC6xKY0lz1ydcUHN2jVlAg== X-Received: by 2002:a17:906:f588:b0:a77:c364:c4f3 with SMTP id a640c23a62f3a-a780b8855dcmr965853266b.55.1720774651663; Fri, 12 Jul 2024 01:57:31 -0700 (PDT) Received: from localhost.localdomain ([84.245.121.236]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a7ff7bbsm327987166b.141.2024.07.12.01.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 01:57:31 -0700 (PDT) From: =?UTF-8?q?Juraj=20Linke=C5=A1?= To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, bruce.richardson@intel.com, jspewock@iol.unh.edu, probb@iol.unh.edu, paul.szczepanek@arm.com, Luca.Vizzarro@arm.com, npratte@iol.unh.edu Cc: dev@dpdk.org, =?UTF-8?q?Juraj=20Linke=C5=A1?= , Luca Vizzarro Subject: [PATCH v8 4/5] doc: guides and API meson improvements Date: Fri, 12 Jul 2024 10:57:23 +0200 Message-Id: <20240712085724.21065-5-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240712085724.21065-1-juraj.linkes@pantheon.tech> References: <20231115133606.42081-1-juraj.linkes@pantheon.tech> <20240712085724.21065-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The Sphinx script argument parsing improvement gives us more flexibility going forward, such as the ability to add non-positional arguments. Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock Acked-by: Bruce Richardson Tested-by: Luca Vizzarro Tested-by: Nicholas Pratte --- buildtools/call-sphinx-build.py | 28 +++++++++++++++++++--------- doc/api/meson.build | 7 ++++--- doc/guides/conf.py | 6 ++---- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/buildtools/call-sphinx-build.py b/buildtools/call-sphinx-build.py index da19e950c9..693274da4e 100755 --- a/buildtools/call-sphinx-build.py +++ b/buildtools/call-sphinx-build.py @@ -3,31 +3,41 @@ # Copyright(c) 2019 Intel Corporation # +import argparse import sys import os from os.path import join from subprocess import run -# assign parameters to variables -(sphinx, version, src, dst, *extra_args) = sys.argv[1:] +parser = argparse.ArgumentParser() +parser.add_argument('sphinx') +parser.add_argument('version') +parser.add_argument('src') +parser.add_argument('dst') +args, extra_args = parser.parse_known_args() # set the version in environment for sphinx to pick up -os.environ['DPDK_VERSION'] = version +os.environ['DPDK_VERSION'] = args.version -sphinx_cmd = [sphinx] + extra_args +sphinx_cmd = [args.sphinx] + extra_args # find all the files sphinx will process so we can write them as dependencies srcfiles = [] -for root, dirs, files in os.walk(src): +for root, dirs, files in os.walk(args.src): srcfiles.extend([join(root, f) for f in files]) +if not os.path.exists(args.dst): + os.makedirs(args.dst) + # run sphinx, putting the html output in a "html" directory -with open(join(dst, 'sphinx_html.out'), 'w') as out: - process = run(sphinx_cmd + ['-b', 'html', src, join(dst, 'html')], - stdout=out) +with open(join(args.dst, 'sphinx_html.out'), 'w') as out: + process = run( + sphinx_cmd + ['-b', 'html', args.src, join(args.dst, 'html')], + stdout=out + ) # create a gcc format .d file giving all the dependencies of this doc build -with open(join(dst, '.html.d'), 'w') as d: +with open(join(args.dst, '.html.d'), 'w') as d: d.write('html: ' + ' '.join(srcfiles) + '\n') sys.exit(process.returncode) diff --git a/doc/api/meson.build b/doc/api/meson.build index 5b50692df9..b828b1ed66 100644 --- a/doc/api/meson.build +++ b/doc/api/meson.build @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Luca Boccassi +doc_api_build_dir = meson.current_build_dir() doxygen = find_program('doxygen', required: get_option('enable_docs')) if not doxygen.found() @@ -32,10 +33,10 @@ example = custom_target('examples.dox', # set up common Doxygen configuration cdata = configuration_data() cdata.set('VERSION', meson.project_version()) -cdata.set('API_EXAMPLES', join_paths(dpdk_build_root, 'doc', 'api', 'examples.dox')) -cdata.set('OUTPUT', join_paths(dpdk_build_root, 'doc', 'api')) +cdata.set('API_EXAMPLES', join_paths(doc_api_build_dir, 'examples.dox')) +cdata.set('OUTPUT', doc_api_build_dir) cdata.set('TOPDIR', dpdk_source_root) -cdata.set('STRIP_FROM_PATH', ' '.join([dpdk_source_root, join_paths(dpdk_build_root, 'doc', 'api')])) +cdata.set('STRIP_FROM_PATH', ' '.join([dpdk_source_root, doc_api_build_dir])) cdata.set('WARN_AS_ERROR', 'NO') if get_option('werror') cdata.set('WARN_AS_ERROR', 'YES') diff --git a/doc/guides/conf.py b/doc/guides/conf.py index 0f7ff5282d..8b440fb2a9 100644 --- a/doc/guides/conf.py +++ b/doc/guides/conf.py @@ -7,8 +7,7 @@ from sphinx import __version__ as sphinx_version from os import listdir from os import environ -from os.path import basename -from os.path import dirname +from os.path import basename, dirname from os.path import join as path_join from sys import argv, stderr @@ -35,8 +34,7 @@ html_show_copyright = False highlight_language = 'none' -release = environ.setdefault('DPDK_VERSION', "None") -version = release +version = environ.setdefault('DPDK_VERSION', "None") master_doc = 'index' -- 2.34.1