From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B90E0A04F9; Thu, 9 Jan 2020 15:52:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 263731DE5D; Thu, 9 Jan 2020 15:52:54 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 49EA52AA6 for ; Thu, 9 Jan 2020 15:52:52 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jan 2020 06:52:50 -0800 X-IronPort-AV: E=Sophos;i="5.69,414,1571727600"; d="scan'208";a="223327295" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.26]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 09 Jan 2020 06:52:48 -0800 Date: Thu, 9 Jan 2020 14:52:45 +0000 From: Bruce Richardson To: Aaron Conole Cc: david.marchand@redhat.com, john.mcnamara@intel.com, bluca@debian.org, dev@dpdk.org, thomas@monjalon.net Message-ID: <20200109145245.GA255@bricha3-MOBL.ger.corp.intel.com> References: <20200109115631.500056-1-bruce.richardson@intel.com> <20200109120801.500394-1-bruce.richardson@intel.com> <20200109120801.500394-6-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Subject: Re: [dpdk-dev] [PATCH v2 5/6] doc/guides: rebuild with meson whenever a file changes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Jan 09, 2020 at 09:27:42AM -0500, Aaron Conole wrote: > Bruce Richardson writes: > > > Add proper support for calling sphinx whenever a file in the doc > > directory changes. This is accomplished by using a wrapper script > > for sphinx, which runs sphinx but also emits a gcc-format dependency > > file listing all the doc files. This is used by ninja so that any > > change to the doc files triggers a rebuild of the docs. > > > > Signed-off-by: Bruce Richardson > > --- > > buildtools/call-sphinx-build.py | 29 +++++++++++++++++++++++++++++ > > buildtools/meson.build | 6 ++++-- > > doc/guides/meson.build | 22 ++++++++-------------- > > 3 files changed, 41 insertions(+), 16 deletions(-) > > create mode 100755 buildtools/call-sphinx-build.py > > > > Acked-by: Aaron Conole > > Some nits follow - it would be good to clean them up before applying but > they are fairly inconsequential. > > > diff --git a/buildtools/call-sphinx-build.py b/buildtools/call-sphinx-build.py > > new file mode 100755 > > index 000000000..027317b9b > > --- /dev/null > > +++ b/buildtools/call-sphinx-build.py > > @@ -0,0 +1,29 @@ > > +#! /usr/bin/env python3 > > +# SPDX-License-Identifier: BSD-3-Clause > > +# Copyright(c) 2019 Intel Corporation > > +# > > + > > +import sys > > +import os > > +import os.path > > +import subprocess > > + > > +sphinx = sys.argv[1] > > +src = sys.argv[2] > > +dst = sys.argv[3] > > +depfile = os.path.join(dst,'.html.d') > ^ whitespace here > > + > > +# find all the files sphinx will process so we can write them as dependencies > > +srcfiles = [] > > +for root, dirs, files in os.walk(src): > > + for f in files: > > + srcfiles.append(os.path.join(root, f)) > > + > > +# run sphinx, putting the html output in a "html" directory > > +subprocess.run([sphinx, '-j', 'auto', '-b', 'html', src, > > + os.path.join(dst, 'html')], check = True) > ^ no whitespace > around = > > + > > +# create a gcc format .d file giving all the dependencies of this doc build > > +with open(depfile, 'w') as d: > > + d.write('html: ' + ' '.join(srcfiles) + '\n') > > +subprocess.run(['cp', '-f', depfile, '/tmp']) Ok, will fix. I also see I left in an unnecessary subprocess.run at the end to copy the file to /tmp. This was for debugging only since ninja deletes the .d files after processing them. [https://ninja-build.org/manual.html#_deps, see behaviour for deps=gcc] /Bruce