From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Famulari Subject: Re: [PATCH 5/5] gnu: python-acme: Generate and install documentation. Date: Thu, 18 Feb 2016 12:46:50 -0500 Message-ID: <20160218174650.GC29070@jasmine> References: <482da9ee97c7605e078a3e089a6c475c72570a34.1455767577.git.leo@famulari.name> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWSfI-0004nl-7m for guix-devel@gnu.org; Thu, 18 Feb 2016 12:46:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWSfF-0003Eb-03 for guix-devel@gnu.org; Thu, 18 Feb 2016 12:46:56 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:36736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWSfE-0003EX-R9 for guix-devel@gnu.org; Thu, 18 Feb 2016 12:46:52 -0500 Content-Disposition: inline In-Reply-To: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ricardo Wurmus Cc: guix-devel@gnu.org On Thu, Feb 18, 2016 at 01:51:40PM +0100, Ricardo Wurmus wrote: > > Leo Famulari writes: > > > * gnu/packages/tls.scm (acme)[arguments]: Add 'docs' phase. > > [native-inputs]: Add python-sphinx, python-sphinxcontrib-programoutput, > > python-sphinx-rtd-theme, python-setuptools, texinfo. > > --- > > gnu/packages/tls.scm | 19 ++++++++++++++++--- > > 1 file changed, 16 insertions(+), 3 deletions(-) > > > > diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm > > index 00d4805..dc6f9b4 100644 > > --- a/gnu/packages/tls.scm > > +++ b/gnu/packages/tls.scm > > @@ -340,11 +340,24 @@ security, and applying best practice development processes.") > > (display "\n[easy_install]\nzip_ok = 0\n" > > port) > > (close-port port) > > - #t)))))) > > - ;; TODO: Add optional inputs for testing and building documentation. > > + #t))) > > + (add-after 'install 'docs > > + (lambda* (#:key outputs #:allow-other-keys) > > + (let* ((out (assoc-ref outputs "out")) > > + (man (string-append out "/share/man/man1")) > > + (info (string-append out "/info"))) > > + (and (zero? (system* "make" "-C" "docs" "man" "info")) > > + (install-file "docs/_build/texinfo/acme-python.info" info) > > + (install-file "docs/_build/man/acme-python.1" man)))))))) > > “install-file” calls “copy-file” last and according to the Guile manual > the return value of “copy-file” is unspecified. In practise this is not > #f, of course, so all the three arguments to “(and ...)” will be > evaluated as long as “make” does not fail. > > However, “and” just returns the return value of its last argument > (unless one of the arguments evaluates to “#f”), which is unspecified, > not “#t”. As we want successful phases to return “#t” you could > explicitly add “#t” as a fourth argument to “(and ...)”. > > Not sure if that’s really necessary, but you did ask for comments about > your use of “and”... :) Thanks for taking the time to write this! I didn't realize that copy-file's return value is unspecified. I've found that it does tend to make the whole build fail when the source file doesn't exist, so it must be returning #f in that case, right? In any case, I can't rely on it if it's unspecified. I wouldn't be surprised if "make" fails the next time this is updated — the process seems rather complicated *and* untested. Since I don't want to proceed if make fails I guess that I should use (and ...), and explicity return #t from the function. What do you think?