From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id CCZSOYd4EV/nXgAA0tVLHw (envelope-from ) for ; Fri, 17 Jul 2020 10:08:07 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id qBowNYd4EV9/dQAA1q6Kng (envelope-from ) for ; Fri, 17 Jul 2020 10:08:07 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5D2BD94005D for ; Fri, 17 Jul 2020 10:08:06 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id D65C41FBDC; Fri, 17 Jul 2020 06:07:54 -0400 (EDT) Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [185.185.170.37]) by mail.notmuchmail.org (Postfix) with ESMTPS id DE26B1F704 for ; Fri, 17 Jul 2020 06:07:50 -0400 (EDT) Received: from guru.guru-group.fi (unknown [IPv6:2a02:2380:1:9:5054:ff:feb7:a4bc]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: too) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 49D921B00258; Fri, 17 Jul 2020 13:07:46 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1594980466; 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: in-reply-to:in-reply-to:references:references; bh=eUU/TmV/R7Dubq2CqZipyPRljuXxjV1hCYIEDJW1lvw=; b=mKFf3wmO0TYIRKpTgpQ9aHTjH8BGhjEzon01YM2LoHBE2UMgCpMIPCx8eQs+Dqc0+YybSC yQ+2I9KCCYqjiYhke4o/EmcsUP1a8HtGRLirAMvCTeqiMoso0hcObPigw4qNsGFabP0nY3 lpq/r7N38dugs4VHsq9XSCeHf7Ep/zyhk3EpeO0TBjGxJwPT/yEKOdpBZ/H3KRXmsCjP/B plfr9hKxflhQA1HTrHorqDOIcJmihhL9gtL35YsNAaVLp343fzMMRD9eD+r+D2wn3fd3vF Apnb3ZIt32HRssKnK10KDivZBoYFYHij19MjIU9YFiFxqnVUK1RNdnOhWMjIzg== From: Tomi Ollila To: Floris Bruynooghe , David Bremner , notmuch@notmuchmail.org Cc: David Bremner Subject: Re: [PATCH 1/2] doc: replace use of environment variables with a generated config In-Reply-To: <87r1tdbxwy.fsf@powell.devork.be> References: <20200711132027.1449094-1-david@tethera.net> <87r1tdbxwy.fsf@powell.devork.be> User-Agent: Notmuch/0.30+12~g9f4381f (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1594980466; 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: in-reply-to:in-reply-to:references:references; bh=eUU/TmV/R7Dubq2CqZipyPRljuXxjV1hCYIEDJW1lvw=; b=AC7yxBdrYnPSeBobvKKavowaaurqiDOcmikhydcDHyLQi3fYiOcGcnmCSyc+yG0HyuPdNf a6RIO6hmE9WAESc1tDILsvELevYDX+wTUPcffupCTf29KdzSK2Cs0IBPWekUTekGb9l8j6 UQ2/SHoJ2uUI5KYEHJLHdcuEFG5yND7xRr80cMRkJ6lj6TpIpSh2NfNzLs6dAWLXNLB3Ke GXN6yvdczUb2O0VOSC6swXmCbXzS33dLVKgxYz/VfTiMJlO7QDPW40EEfMuDMT8KSsfxsT CYbBXUy8X0lFoqfBXQEYinJEXoPK+k1FXCX0XlJx/lXtKCM2c+auFWL3v00EPw== ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1594980466; a=rsa-sha256; cv=none; b=GhKhvPxiJhX+goiluGBaEsKOaYAYQGFp+3eCEreSIUA++yoBCszVng+lqgA7NKY8PY5vA4 l9o4r+Sq9mkA78iRSdBJ8fcDRYNCl0OdulLvqT6oD/76KZ6ABL5V9QFuY+iHc3M2D7I+uN E7axPVtk2og1wJdSzGvfu1H2IzO/wC3j3IG+mBO2tsj5etXcG0MM0SD75TEIhk+UeXvSHY 8+cL5LC0M/UFMHt8+HDRLj/G+GUsKZ3pVoHjFIPcZXEmcamFS/+2EKrSI5MmejXDqmbx7A UJXMXa0zgqIj7aRH2ykSfnm8SDdCkM13gAa3LehncHOzBNSc0fNMGKHwcuhJvg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=too smtp.mailfrom=tomi.ollila@iki.fi Message-ID-Hash: CV3MPFFE7UYQBVKNZ7AX5RVF7GXJDFZW X-Message-ID-Hash: CV3MPFFE7UYQBVKNZ7AX5RVF7GXJDFZW X-MailFrom: tomi.ollila@iki.fi X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=iki.fi header.s=lahtoruutu header.b=mKFf3wmO; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: 2.03 X-TUID: Uvhz1FolwQFD On Tue, Jul 14 2020, Floris Bruynooghe wrote: > On Sat 11 Jul 2020 at 10:20 -0300, David Bremner wrote: > >> I don't love the use of exec, but it is getting unwieldy to pass > > It's already a config file written in Python which is a terrible sin. > So no need to apologise, I think it makes sense in this context. > >> configuration options on the sphinx-build command line, and I >> anticipate further use of conditionals. >> --- >> configure | 8 ++++++++ >> doc/Makefile.local | 2 +- >> doc/conf.py | 11 ++++++++--- >> 3 files changed, 17 insertions(+), 4 deletions(-) >> >> diff --git a/configure b/configure >> index 80cbac4f..177432db 100755 >> --- a/configure >> +++ b/configure >> @@ -1548,6 +1548,14 @@ NOTMUCH_HAVE_PYTHON3_PYTEST=${have_python3_pytest} >> PLATFORM=${platform} >> EOF >> >> +cat > sphinx.config <> +# Generate by configure, run from doc/conf.py > > Minor insignificant typo: Generated Just to tease David more, I think I had that fixed in my suggestion ;) LFTM with this typo fixed. Tomi > >> +EOF >> +if [ $WITH_EMACS = "1" ]; then >> + printf "tags.add('WITH_EMACS')\n" >> sphinx.config >> +fi >> +printf "rsti_dir = '%s'\n" $(realpath emacs) >> sphinx.config >> + >> # Finally, after everything configured, inform the user how to continue. >> cat <> >> diff --git a/doc/Makefile.local b/doc/Makefile.local >> index 769438ed..598b6028 100644 >> --- a/doc/Makefile.local >> +++ b/doc/Makefile.local >> @@ -4,7 +4,7 @@ dir := doc >> >> # You can set these variables from the command line. >> SPHINXOPTS := -q >> -SPHINXBUILD = WITH_EMACS=${WITH_EMACS} RSTI_DIR=$(realpath emacs) sphinx-build >> +SPHINXBUILD = sphinx-build >> DOCBUILDDIR := $(dir)/_build >> >> # Internal variables. >> diff --git a/doc/conf.py b/doc/conf.py >> index 70987ac5..fdff2a2c 100644 >> --- a/doc/conf.py >> +++ b/doc/conf.py >> @@ -22,6 +22,13 @@ for pathdir in ['.', '..']: >> with open(version_file,'r') as infile: >> version=infile.read().replace('\n','') >> >> +# read generated config >> +for pathdir in ['.', '..']: >> + conf_file = os.path.join(location,pathdir,'sphinx.config') >> + if os.path.exists(conf_file): >> + with open(conf_file,'r') as infile: >> + exec(''.join(infile.readlines())) >> + >> # The full version, including alpha/beta/rc tags. >> release = version >> >> @@ -29,12 +36,10 @@ release = version >> # directories to ignore when looking for source files. >> exclude_patterns = ['_build'] >> >> -if os.environ.get('WITH_EMACS') == '1': >> +if tags.has('WITH_EMACS'): >> # Hacky reimplementation of include to workaround limitations of >> # sphinx-doc >> lines = ['.. include:: /../emacs/rstdoc.rsti\n\n'] # in the source tree >> - rsti_dir = os.environ.get('RSTI_DIR') >> - # the other files are from the build tree >> for file in ('notmuch.rsti', 'notmuch-lib.rsti', 'notmuch-show.rsti', 'notmuch-tag.rsti'): >> lines.extend(open(rsti_dir+'/'+file)) >> rst_epilog = ''.join(lines) > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org