import/pypi: Improve renaming procedure.

A package named upstream like 'tmdb-python' now gets named 'python-tmdb'
instead of 'python-tmdb-python', which is ugly and doesn't match our
convention (info "(guix) Python Modules").

* guix/import/pypi.scm (python->package-name): Turn a -python suffix into a
python- prefix.

Change-Id: I7c0227d569c0afe6b16329d7cedb51728e4365b0
This commit is contained in:
Maxim Cournoyer 2025-04-07 16:20:29 +09:00
parent 19de75a165
commit 5af2a0c390
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -179,6 +179,8 @@ or #f if there isn't any."
package." package."
(cond (cond
((string-prefix? "python-" name) (snake-case name)) ((string-prefix? "python-" name) (snake-case name))
((string-suffix? "-python" name)
(string-append "python-" (string-drop-right name 7)))
((or (string=? "trytond" name) ((or (string=? "trytond" name)
(string-prefix? "trytond-" name)) (snake-case name)) (string-prefix? "trytond-" name)) (snake-case name))
(else (string-append "python-" (snake-case name))))) (else (string-append "python-" (snake-case name)))))