DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Cc: dev@dpdk.org, Vipin Varghese <vipin.varghese@amd.com>
Subject: Re: [PATCH 3/3] doc: rewrite shell scripts in Python
Date: Fri, 1 Apr 2022 17:31:08 +0100	[thread overview]
Message-ID: <YkcozNW6evfXjwNA@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <20220331212830.708912-4-dmitry.kozliuk@gmail.com>

On Fri, Apr 01, 2022 at 12:28:30AM +0300, Dmitry Kozlyuk wrote:
> Shell used in documentation generation could not run on Windows.
> Rewrite scripts in Python.
> New scripts use proper path separators and handle paths with spaces.
> 
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---

Generally looks ok to me, couple of minor comments inline below.

Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>

>  doc/api/generate_doxygen.py  | 19 +++++++++++++++++++
>  doc/api/generate_doxygen.sh  | 12 ------------
>  doc/api/generate_examples.py | 31 +++++++++++++++++++++++++++++++
>  doc/api/generate_examples.sh | 20 --------------------
>  doc/api/meson.build          |  6 +++---
>  5 files changed, 53 insertions(+), 35 deletions(-)
>  create mode 100644 doc/api/generate_doxygen.py
>  delete mode 100755 doc/api/generate_doxygen.sh
>  create mode 100644 doc/api/generate_examples.py
>  delete mode 100755 doc/api/generate_examples.sh
> 
<snip>

> diff --git a/doc/api/generate_examples.py b/doc/api/generate_examples.py
> new file mode 100644
> index 0000000000..66933f9472
> --- /dev/null
> +++ b/doc/api/generate_examples.py
> @@ -0,0 +1,31 @@
> +#!/usr/bin/env python3
> +# SPDX-License-Identifier: BSD-3-Clause
> +# (c) 2018 Luca Boccassi <bluca@debian.org>
> +# (c) 2022 Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> +
> +import os, sys
> +
> +examples_dir, api_examples = sys.argv[1:]
> +
> +sources = []
> +with open(f'{api_examples}.d', 'w') as dep:
> +    print(f'{api_examples}:', end=' ', file=dep)
> +    for root, _, files in os.walk(examples_dir):
> +        for name in files:
> +            is_source = name.endswith('.c')
> +            if is_source or name == 'meson.meson.build':

duplicate "meson."

> +                path = os.path.join(root, name)
> +                if is_source:
> +                    sources.append(path)
> +                print(path , end=' ', file=dep)
> +
> +sys.stdout = open(api_examples, 'w')

While this is a literal translation of what is done in the .sh file, I
wonder if, for consistency, in the python versions we should always either
use stdout redirection or always use "file=" option to printing. Right now
we have a mix of both.

> +print('/**')
> +print('@page examples DPDK Example Programs')
> +print()

Is this additional print done deliberately for clarity vs just putting '\n'
on previous line?

> +for path in sources:
> +    # Produce consistent output with forward slashes on all systems.
> +    # Every \ in paths within examples directory is a separator, not escape.
> +    relpath = os.path.relpath(path, examples_dir).replace('\\', '/')
> +    print(f'@example examples/{relpath}')
> +print('*/')

  reply	other threads:[~2022-04-01 16:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 21:28 [PATCH 0/3] doc: build on Windows Dmitry Kozlyuk
2022-03-31 21:28 ` [PATCH 1/3] doc: simplify CSS customization for Doxygen Dmitry Kozlyuk
2022-03-31 21:28 ` [PATCH 2/3] doc: fix API index Markdown syntax Dmitry Kozlyuk
2022-03-31 21:28 ` [PATCH 3/3] doc: rewrite shell scripts in Python Dmitry Kozlyuk
2022-04-01 16:31   ` Bruce Richardson [this message]
2022-04-01 21:47     ` Dmitry Kozlyuk
2022-04-06 17:10 ` [PATCH v2 0/3] doc: build on Windows Dmitry Kozlyuk
2022-04-06 17:10   ` [PATCH v2 1/3] doc: simplify CSS customization for Doxygen Dmitry Kozlyuk
2022-04-06 17:10   ` [PATCH v2 2/3] doc: fix API index Markdown syntax Dmitry Kozlyuk
2022-04-06 17:10   ` [PATCH v2 3/3] doc: rewrite shell scripts in Python Dmitry Kozlyuk
2022-05-11  9:34   ` [PATCH v2 0/3] doc: build on Windows Varghese, Vipin
2022-05-11 10:56     ` Dmitry Kozlyuk
2022-06-01 10:47   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YkcozNW6evfXjwNA@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=vipin.varghese@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).