Subject: Re: bug#53395: Fix pypi import for flake8-array-spacing

From: Ludovic Courtès <[email-masked]>
Date: Mon, 24 Jan 2022 15:05:47 +0100

Hello!

Vivien Kraus <[email-masked]> skribis:

> From d8923c394fbe2e8eedf6fa548455d398f0caa022 Mon Sep 17 00:00:00 2001
> From: Vivien Kraus <[email-masked]>
> Date: Thu, 20 Jan 2022 20:11:56 +0100
> Subject: [PATCH] pypi importer: Convert - to _ in pypi urls if needed.
>
> * guix/import/pypi.scm (find-project-url): New function.
> (make-pypi-sexp): Use find-project-url.

[...]

> +(define (find-project-url name pypi-url)
> +  "Try different project name substitution until the result is found in
> +pypi-url.  Downcase is required for \"Deprecated\" and \"uWSGI\", and
> +underscores are required for flake8-array-spacing."
> +  (or (find (cut string-contains pypi-url <>)
> +            (list name
> +                  (string-downcase name)
> +                  (string-replace-substring name "-" "_")))
> +      (begin
> +        (warning (G_ "The project name `~a' does not appear in the pypi URL; you might need to fix the pypi-url declaration in the generated package.  The URL is: ~a~%")
> +                 name pypi-url)
> +        name)))

As a rule of thumb, warnings are one-line messages (not sentences)
describing the problem.  Here you could emit such a warning, followed by
a call to ‘display-hint’, which accepts Texinfo markup.

Could you adjust accordingly?

Also, what about adding a unit test?

Thanks,
Ludo’.