GNU bug report logs -
#29847
[PATCH] import: pypi: Stay in the REPL if fail to get a source
Previous Next
Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>
Date: Mon, 25 Dec 2017 13:49:02 UTC
Severity: normal
Tags: patch
Done: ludo <at> gnu.org (Ludovic Courtès)
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hello Ludovic,
Apologies for a long reply.
ludo <at> gnu.org (Ludovic Courtès) writes:
> Ping!
>
> ludo <at> gnu.org (Ludovic Courtès) skribis:
>
>> OK for the patch, but please simply replace ‘leave’ with ‘warning’.
I think the patch is no longer needed, because ‘pypi->guix-package’
returns false (‘#f’) and REPL survives if a package doesn't exist:
--8<---------------cut here---------------start------------->8---
scheme@(guix import pypi)> (pypi->guix-package "psutil")
Starting download of /tmp/guix-file.9Q8PGN
From https://pypi.python.org/packages/e2/e1/600326635f97fee89bf8426fef14c5c29f4849c79f68fd79f433d8c1bd96/psutil-5.4.3.tar.gz...
…4.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/6dd427e738a8db6d0b66525856da43d2ef12c4c19269863927f7cf0e2aaf/psutil-5.4.3-cp27-none-win32.whl...
…7-none-win32.whl 216KiB 1.3MiB/s 00:00 [##################] 100.0%
$3 = (package (name "python-psutil") #; more fields here)
scheme@(guix import pypi)> (pypi->guix-package "psutils") ; ‘psutils’ doesn't exist in ‘pypi’
$4 = #f
--8<---------------cut here---------------end--------------->8---
WDYT?
> Note that at the REPL you can always do:
>
> (catch 'quit (lambda () …) (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 ‘guile’ in
Bash. Putting the macro in ‘~/.guile’ doesn't help unfortunately.
Thanks,
Oleg.
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 7 years and 56 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.