From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1XQR-0004hv-D8 for guix-patches@gnu.org; Thu, 29 Mar 2018 09:17:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1XQM-0006Ho-Ef for guix-patches@gnu.org; Thu, 29 Mar 2018 09:17:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:50264) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f1XQM-0006Hk-Aj for guix-patches@gnu.org; Thu, 29 Mar 2018 09:17:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f1XQM-0001rj-4I for guix-patches@gnu.org; Thu, 29 Mar 2018 09:17:02 -0400 Subject: [bug#29847] [PATCH] import: pypi: Stay in the REPL if fail to get a source Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <877etaq5si.fsf@gmail.com> <87373cnkgg.fsf@gnu.org> Date: Thu, 29 Mar 2018 15:16:53 +0200 In-Reply-To: <87373cnkgg.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 11 Jan 2018 22:39:59 +0100") Message-ID: <87605fvx6i.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Oleg Pykhalov Cc: 29847@debbugs.gnu.org Ping! ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > Hi Oleg, > > Oleg Pykhalov skribis: > >> If pypi->guix-package fails to get a source release, could we return >> false instead of killing a running Guile REPL session? > > Note that at the REPL you can always do: > > (catch 'quit (lambda () =E2=80=A6) (const #f)) > >> (guard (c ((missing-source-error? c) >> (let ((package (missing-source-error-package c))) >> - (leave (G_ "no source release for pypi package ~a= ~a~%") >> - (assoc-ref* package "info" "name") >> - (assoc-ref* package "info" "version"))))) >> + (format (current-error-port) >> + (G_ "no source release for pypi package ~= a ~a~%") >> + (assoc-ref* package "info" "name") >> + (assoc-ref* package "info" "version")) >> + #f))) > > OK for the patch, but please simply replace =E2=80=98leave=E2=80=99 with = =E2=80=98warning=E2=80=99. > > Note that for me the motivation is not to avoid exiting REPLs since it=E2= =80=99s > easy to avoid anyway. The motivation is rather to make it easier to > integrate importers in applications other than =E2=80=98guix import=E2=80= =99: =E2=80=98guix > refresh=E2=80=99 is one of them, but then I=E2=80=99d also like importers= /updaters to be > directly used from =E2=80=98guix package=E2=80=99. For that, it=E2=80=99= s a good idea to avoid > calling =E2=80=98exit=E2=80=99 on the first occasion, obviously. > > Thanks, > Ludo=E2=80=99.