From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f328p-0006kY-BB for guix-patches@gnu.org; Mon, 02 Apr 2018 12:17:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f328k-0007Ra-Sy for guix-patches@gnu.org; Mon, 02 Apr 2018 12:17:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:55660) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f328k-0007RU-On for guix-patches@gnu.org; Mon, 02 Apr 2018 12:17:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f328k-0005Hk-HK for guix-patches@gnu.org; Mon, 02 Apr 2018 12:17:02 -0400 Subject: bug#29847: [PATCH] import: pypi: Stay in the REPL if fail to get a source Resent-To: guix-patches@gnu.org Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <877etaq5si.fsf@gmail.com> <87373cnkgg.fsf@gnu.org> <87605fvx6i.fsf@gnu.org> <87zi2nnjld.fsf@gmail.com> Date: Mon, 02 Apr 2018 18:16:23 +0200 In-Reply-To: <87zi2nnjld.fsf@gmail.com> (Oleg Pykhalov's message of "Sun, 01 Apr 2018 16:26:38 +0300") Message-ID: <87h8otfuso.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-done@debbugs.gnu.org Hi Oleg, Oleg Pykhalov skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Ping! >> >> ludo@gnu.org (Ludovic Court=C3=A8s) skribis: >> >>> OK for the patch, but please simply replace =E2=80=98leave=E2=80=99 wit= h =E2=80=98warning=E2=80=99. > > I think the patch is no longer needed, because =E2=80=98pypi->guix-packag= e=E2=80=99 > returns false (=E2=80=98#f=E2=80=99) and REPL survives if a package doesn= 't exist: > > scheme@(guix import pypi)> (pypi->guix-package "psutil") > > Starting download of /tmp/guix-file.9Q8PGN > From https://pypi.python.org/packages/e2/e1/600326635f97fee89bf8426fef14c= 5c29f4849c79f68fd79f433d8c1bd96/psutil-5.4.3.tar.gz... > =E2=80=A64.3.tar.gz 403KiB 1.6MiB/s 00:00 [###########= #######] 100.0% > > Starting download of /tmp/guix-file.Vn9nDZ > From https://pypi.python.org/packages/e5/cc/6dd427e738a8db6d0b66525856da4= 3d2ef12c4c19269863927f7cf0e2aaf/psutil-5.4.3-cp27-none-win32.whl... > =E2=80=A67-none-win32.whl 216KiB 1.3MiB/s 00:00 [###########= #######] 100.0% > $3 =3D (package (name "python-psutil") #; more fields here) > scheme@(guix import pypi)> (pypi->guix-package "psutils") ; =E2=80=98psut= ils=E2=80=99 doesn't exist in =E2=80=98pypi=E2=80=99 > $4 =3D #f > > WDYT? Indeed it should no longer be needed. >> Note that at the REPL you can always do: >> >> (catch 'quit (lambda () =E2=80=A6) (const #f)) > > Thank you! Based on this I wrote a macro: > > (define-macro (try function) > `(catch 'quit (lambda () ,function) (const #f))) > > but I don't know how to make it available after invoking =E2=80=98guile= =E2=80=99 in > Bash. Putting the macro in =E2=80=98~/.guile=E2=80=99 doesn't help unfor= tunately. I just tried and it works for me. Note that ~/.guile is only read when starting an interactive Guile (a REPL), not when starting guile to run a program. Thanks, Ludo=E2=80=99.