From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:47130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpcKF-0000Zq-Jp for qemu-devel@nongnu.org; Fri, 01 Feb 2019 12:10:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gpcEh-0004mT-74 for qemu-devel@nongnu.org; Fri, 01 Feb 2019 12:04:16 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:41067) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gpcEf-0004kv-Dm for qemu-devel@nongnu.org; Fri, 01 Feb 2019 12:04:15 -0500 Received: by mail-wr1-x441.google.com with SMTP id x10so7865734wrs.8 for ; Fri, 01 Feb 2019 09:04:12 -0800 (PST) References: <20190201145035.22739-1-peter.maydell@linaro.org> <20190201145035.22739-12-peter.maydell@linaro.org> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <20190201145035.22739-12-peter.maydell@linaro.org> Date: Fri, 01 Feb 2019 17:04:09 +0000 Message-ID: <87bm3vv3sm.fsf@zen.linaroharston> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 11/11] docs/conf.py: Don't hard-code QEMU version List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, patches@linaro.org, Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Paolo Bonzini , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Peter Maydell writes: > Don't hard-code the QEMU version number into conf.py. Instead > we either pass it to sphinx-build on the command line, or > (if doing a standalone Sphinx run in a readthedocs.org setup) > extract it from the VERSION file. > > Signed-off-by: Peter Maydell Ahh the perils of not reading ahead ;-) Reviewed-by: Alex Benn=C3=A9e > --- > Makefile | 2 +- > docs/conf.py | 21 ++++++++++++++++----- > 2 files changed, 17 insertions(+), 6 deletions(-) > > diff --git a/Makefile b/Makefile > index 2d19d28a271..e342242d268 100644 > --- a/Makefile > +++ b/Makefile > @@ -863,7 +863,7 @@ docs/version.texi: $(SRC_PATH)/VERSION > sphinxdocs: docs/devel/index.html docs/interop/index.html > > # Canned command to build a single manual > -build-manual =3D $(call quiet-command,sphinx-build $(if $(V),,-q) -b htm= l -d .doctrees/$1 $(SRC_PATH)/docs/$1 docs/$1 ,"SPHINX","docs/$1") > +build-manual =3D $(call quiet-command,sphinx-build $(if $(V),,-q) -b htm= l -D version=3D$(VERSION) -D release=3D"$(FULL_VERSION)" -d .doctrees/$1 $(= SRC_PATH)/docs/$1 docs/$1 ,"SPHINX","docs/$1") > # We assume all RST files in the manual's directory are used in it > manual-deps =3D $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(SRC_PATH)/docs/$= 1/conf.py $(SRC_PATH)/docs/conf.py > > diff --git a/docs/conf.py b/docs/conf.py > index 6a334f545ec..0842d44e930 100644 > --- a/docs/conf.py > +++ b/docs/conf.py > @@ -75,11 +75,22 @@ author =3D u'The QEMU Project Developers' > # The version info for the project you're documenting, acts as replaceme= nt for > # |version| and |release|, also used in various other places throughout = the > # built documents. > -# > -# The short X.Y version. > -version =3D u'4.0' > -# The full version, including alpha/beta/rc tags. > -release =3D u'4.0' > + > +# Extract this information from the VERSION file, for the benefit of > +# standalone Sphinx runs as used by readthedocs.org. Builds run from > +# the Makefile will pass version and release on the sphinx-build > +# command line, which override this. > +try: > + extracted_version =3D None > + with open(os.path.join(qemu_docdir, '../VERSION')) as f: > + extracted_version =3D f.readline().strip() > +except: > + pass > +finally: > + if extracted_version: > + version =3D release =3D extracted_version > + else: > + version =3D release =3D "unknown version" > > # The language for content autogenerated by Sphinx. Refer to documentati= on > # for a list of supported languages. -- Alex Benn=C3=A9e