From 00762a4c4c8ecdd71cccf6afdd87ae68bf9b4964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 2 Feb 2022 15:55:21 +0100 Subject: [PATCH] import: pypi: Display a hint upon "no source release" errors. Fixes . * guix/import/pypi.scm (pypi->guix-package): Upon 'missing-source-error?', raise a compound condition with a hint. --- guix/import/pypi.scm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index b80f43ac15..e07b792c53 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 David Thompson ;;; Copyright © 2015 Cyril Roelandt -;;; Copyright © 2015, 2016, 2017, 2019, 2020, 2021 Ludovic Courtès +;;; Copyright © 2015-2017, 2019-2022 Ludovic Courtès ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2018 Ricardo Wurmus ;;; Copyright © 2019 Maxim Cournoyer @@ -499,8 +499,20 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE." (and project (guard (c ((missing-source-error? c) (let ((package (missing-source-error-package c))) - (leave (G_ "no source release for pypi package ~a ~a~%") - (project-info-name info) version)))) + (raise + (make-compound-condition + (formatted-message + (G_ "no source release for pypi package ~a ~a~%") + (project-info-name info) version) + (condition + (&fix-hint + (hint (format #f (G_ "This indicates that the +package is available on PyPI, but only as a \"wheel\" containing binaries, not +source. To build it from source, refer to the upstream repository at +@uref{~a}.") + (or (project-info-home-page info) + (project-info-url info) + "?")))))))))) (make-pypi-sexp (project-info-name info) version (and=> (source-release project version) distribution-url)