From patchwork Thu Aug 1 09:37:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Juraj_Linke=C5=A1?= X-Patchwork-Id: 142817 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 89A644570F; Thu, 1 Aug 2024 11:38:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7522543380; Thu, 1 Aug 2024 11:37:50 +0200 (CEST) Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by mails.dpdk.org (Postfix) with ESMTP id 35CAB43374 for ; Thu, 1 Aug 2024 11:37:48 +0200 (CEST) Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a7aa086b077so603318366b.0 for ; Thu, 01 Aug 2024 02:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1722505068; x=1723109868; 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=9H3h0hnVobiWVtPtCxzAoPkOJnETOzrRx+fjkE0+HCk=; b=XlDpZRA/OrL3s/HBrBKkCOKY84tkXSfcUbKk1FgLDn01XDtlAe6oJb1t/3a9EAvh79 3emiMv8vWrkkGCpzHfkz39xwDDE9oTuU0GlmxD32NUW5AFIk5yiXLLMafcX+mpfwpI0x FQzXa7c8i7Ni3UEBB2r7sAB5GgewX5PXjE+LlcZKxBIZOxmhdsggF6EXSvCmVXBiqyWD snkjBfSojuFpNlnKz9iupPIV839W/zqbl4aZPA+V5cQMqJuSv1vbN9Hzx00egj5IZ4pD wAEvnrAc6cnHAnV4cWSp2NqboBbBVJ4xNzH4YdgNrirmtAfIPQMdrwoFPc5Xw59mncnZ HtdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722505068; x=1723109868; 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=9H3h0hnVobiWVtPtCxzAoPkOJnETOzrRx+fjkE0+HCk=; b=xRGReeSUdDHqknETLePWxZS18wtOudnx66VNad1Mjdq01eN2kN86UgkMPGdQytjwLG LZ3jbUPenmg5HMi+6Jh+m7mVz7QQ0q9q08f0ZnLQNUeR6c9QA5S658LQ/PiyJBqI02yM gae6AOpMjZ9+vSlNX/sd572ZtTCwEVXyHhCr7uhqv3+Iq/1b0kxtcumzZGHpbEvIvVfi MVHA4KmWUMYddvOxjKXIe9B5JNmxezRKxKlhK310kkHo5CVQGlrA0nye+bynkHO/mxKu Q3ZCUuvxNQALUmTQQhQ6/5EXDZjzs20WCd2WWcy7J7eoiiu0iI0m3tZCgYUeVI5f7A4k gJ7g== X-Gm-Message-State: AOJu0YwkQy1NqnsxzHZOEwXoiWVDpb2cpojTvDhBdDTqdmKGn3acCVlp 79889kLgqaSjinOtJirfLzvD7qhqSPmgQnNLfolOY4RNZkojCeWz62ThD6F3NMO1V5tKSwJ5N2D 9vvA= X-Google-Smtp-Source: AGHT+IFDR3Ba8nvtgVX/PCawnyhnDjEneteN2MN6CMJs5a0cp52BI/br7fjuGGymh6Ta3umb8XZK/g== X-Received: by 2002:a17:907:3f9d:b0:a72:7d5c:ace0 with SMTP id a640c23a62f3a-a7daf288ce5mr157931366b.11.1722505067743; Thu, 01 Aug 2024 02:37:47 -0700 (PDT) Received: from localhost.localdomain ([84.245.121.236]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acab236eesm869742266b.22.2024.08.01.02.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 02:37:47 -0700 (PDT) From: =?utf-8?q?Juraj_Linke=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_Linke=C5=A1?= , Luca Vizzarro Subject: [PATCH v10 4/5] doc: guides and API meson improvements Date: Thu, 1 Aug 2024 11:37:39 +0200 Message-Id: <20240801093740.237929-5-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240801093740.237929-1-juraj.linkes@pantheon.tech> References: <20231115133606.42081-1-juraj.linkes@pantheon.tech> <20240801093740.237929-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 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 | 32 +++++++++++++++++++++----------- doc/api/meson.build | 7 ++++--- doc/guides/conf.py | 6 ++---- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/buildtools/call-sphinx-build.py b/buildtools/call-sphinx-build.py index 623e7363ee..2034160049 100755 --- a/buildtools/call-sphinx-build.py +++ b/buildtools/call-sphinx-build.py @@ -3,6 +3,7 @@ # Copyright(c) 2019 Intel Corporation # +import argparse import filecmp import shutil import sys @@ -10,32 +11,41 @@ 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') # copy custom CSS file css = 'custom.css' -src_css = join(src, css) -dst_css = join(dst, 'html', '_static', 'css', css) +src_css = join(args.src, css) +dst_css = join(args.dst, 'html', '_static', 'css', css) if not os.path.exists(dst_css) or not filecmp.cmp(src_css, dst_css): os.makedirs(os.path.dirname(dst_css), exist_ok=True) shutil.copyfile(src_css, dst_css) 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'