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 8E581A0507; Fri, 1 Apr 2022 18:31:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33D8740E03; Fri, 1 Apr 2022 18:31:16 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id B8BE64067E for ; Fri, 1 Apr 2022 18:31:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648830674; x=1680366674; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=J3TdPBzumvujXkjJCtYo6OARGZ5cpnMobn4UxH49Dsw=; b=E2TUc9wkUwMSLZORjA7Lvy5kWRq3NWpM/3Q8UzkEr3g8FXfrCBDmDo6I ETwvQX5pMuOaXESPjeaWv+3NXK536uY4sygCXpDMSBPoKeE2RzacVDBX9 VZfJawrHm/ScuEBcvwDjN1jojhRsF0RSom3Gedzu2zF/Ak0JuirrASRJQ gfuuYv8qat61anDNVm5hCpyD9NCF8SHbhykKxS/gdaMIYRWc1NtFMkmlo Q/FzE2cPJ/jT3/y6kAlWyDNZ5yAZnVW1FZWvLbGtBSITKj2xpesPY888Z PCo/GTIx7RgcKWG/Gq9ExaaficBOCFeaoRur0ofOaQM7DYcyl7o3NVVL8 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10304"; a="257757511" X-IronPort-AV: E=Sophos;i="5.90,228,1643702400"; d="scan'208";a="257757511" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2022 09:31:12 -0700 X-IronPort-AV: E=Sophos;i="5.90,228,1643702400"; d="scan'208";a="567616472" Received: from bricha3-mobl.ger.corp.intel.com ([10.55.133.67]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 01 Apr 2022 09:31:11 -0700 Date: Fri, 1 Apr 2022 17:31:08 +0100 From: Bruce Richardson To: Dmitry Kozlyuk Cc: dev@dpdk.org, Vipin Varghese Subject: Re: [PATCH 3/3] doc: rewrite shell scripts in Python Message-ID: References: <20220331212830.708912-1-dmitry.kozliuk@gmail.com> <20220331212830.708912-4-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220331212830.708912-4-dmitry.kozliuk@gmail.com> 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 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 > --- Generally looks ok to me, couple of minor comments inline below. Reviewed-by: Bruce Richardson > 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 > > 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 > +# (c) 2022 Dmitry Kozlyuk > + > +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('*/')