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 1C667A046B; Thu, 9 Jan 2020 15:27:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EB1541DE28; Thu, 9 Jan 2020 15:27:51 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id E189B1DE23 for ; Thu, 9 Jan 2020 15:27:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578580070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2pGzVnZKX0F22AYDN4k/beHIikIyGe5tO3fyNQOzTno=; b=LaSBI5ATBxLp+gdzmb4ISlqlMs0tqgfoTNsXnk8+FLNC4Wnn6aZgBqXNW9LcAvvNwi2ljD zptThJ2ce/a2/aFQxqCtCkX5/tnvCQFgdK9qWYrURl6f5QNlG0/ABdFfOk63Z3uId5BXrY yma+USnGtg8rbCIKIiRF6+Kn5OH6G/w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-260-fxnh1z68MAKitlkMxy7nCQ-1; Thu, 09 Jan 2020 09:27:48 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F18F107ACC5; Thu, 9 Jan 2020 14:27:47 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (ovpn-124-121.rdu2.redhat.com [10.10.124.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0AC8419C6A; Thu, 9 Jan 2020 14:27:43 +0000 (UTC) From: Aaron Conole To: Bruce Richardson Cc: david.marchand@redhat.com, john.mcnamara@intel.com, bluca@debian.org, dev@dpdk.org, thomas@monjalon.net References: <20200109115631.500056-1-bruce.richardson@intel.com> <20200109120801.500394-1-bruce.richardson@intel.com> <20200109120801.500394-6-bruce.richardson@intel.com> Date: Thu, 09 Jan 2020 09:27:42 -0500 In-Reply-To: <20200109120801.500394-6-bruce.richardson@intel.com> (Bruce Richardson's message of "Thu, 9 Jan 2020 12:08:00 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: fxnh1z68MAKitlkMxy7nCQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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" 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-bui= ld.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 =3D sys.argv[1] > +src =3D sys.argv[2] > +dst =3D sys.argv[3] > +depfile =3D os.path.join(dst,'.html.d') ^ whitespace here > + > +# find all the files sphinx will process so we can write them as depende= ncies > +srcfiles =3D [] > +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 =3D True) ^ no whitespace around =3D > + > +# create a gcc format .d file giving all the dependencies of this doc bu= ild > +with open(depfile, 'w') as d: > + d.write('html: ' + ' '.join(srcfiles) + '\n') > +subprocess.run(['cp', '-f', depfile, '/tmp']) > diff --git a/buildtools/meson.build b/buildtools/meson.build > index 6ef2c5721..cd1d05403 100644 > --- a/buildtools/meson.build > +++ b/buildtools/meson.build > @@ -10,10 +10,12 @@ check_experimental_syms =3D find_program('check-exper= imental-syms.sh') > # set up map-to-def script using python, either built-in or external > python3 =3D import('python').find_installation(required: false) > if python3.found() > -=09map_to_def_cmd =3D [python3, files('map_to_def.py')] > +=09py3 =3D [python3] > else > -=09map_to_def_cmd =3D ['meson', 'runpython', files('map_to_def.py')] > +=09py3 =3D ['meson', 'runpython'] > endif > +map_to_def_cmd =3D py3 + files('map_to_def.py') > +sphinx_wrapper =3D py3 + files('call-sphinx-build.py') > =20 > # stable ABI always starts with "DPDK_" > is_experimental_cmd =3D [find_program('grep', 'findstr'), '^DPDK_'] > diff --git a/doc/guides/meson.build b/doc/guides/meson.build > index 80c21d168..732e7ad3a 100644 > --- a/doc/guides/meson.build > +++ b/doc/guides/meson.build > @@ -7,24 +7,18 @@ if not sphinx.found() > =09subdir_done() > endif > =20 > -htmldir =3D join_paths('share', 'doc', 'dpdk') > +htmldir =3D join_paths(get_option('datadir'), 'doc', 'dpdk') > html_guides =3D custom_target('html_guides', > -=09input: meson.current_source_dir(), > -=09output: 'guides', > -=09command: [sphinx, '-b', 'html', > -=09=09'-d', meson.current_build_dir() + '/.doctrees', > -=09=09'@INPUT@', meson.current_build_dir() + '/guides'], > +=09input: files('index.rst'), > +=09output: 'html', > +=09command: [sphinx_wrapper, sphinx, meson.current_source_dir(), meson.c= urrent_build_dir()], > +=09depfile: '.html.d', > =09build_by_default: get_option('enable_docs'), > =09install: get_option('enable_docs'), > =09install_dir: htmldir) > =20 > +install_data(files('custom.css'), > +=09=09=09install_dir: join_paths(htmldir,'_static', 'css')) > + > doc_targets +=3D html_guides > doc_target_names +=3D 'HTML_Guides' > - > -# sphinx leaves a .buildinfo in the target directory, which we don't > -# want to install. Note that sh -c has to be used, otherwise the > -# env var does not get expanded if calling rm/install directly. > -meson.add_install_script('sh', '-c', > -=09'rm -f $MESON_INSTALL_DESTDIR_PREFIX/share/doc/dpdk/guides/.buildinfo= ') > -meson.add_install_script('sh', '-c', > -=09'install -D -m0644 $MESON_SOURCE_ROOT/doc/guides/custom.css $MESON_IN= STALL_DESTDIR_PREFIX/share/doc/dpdk/guides/_static/css/custom.css')