Subject: [PATCH] import/pypi: Improve renaming procedure.
From: Maxim Cournoyer <[email-masked]>
To: [email-masked]
Cc: Maxim Cournoyer <[email-masked]>
Date: Mon, 7 Apr 2025 16:20:29 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

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
---
 guix/import/pypi.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index dd43ebdcf3..5e2c6ec9ff 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -179,6 +179,8 @@ (define (python->package-name name)
 package."
   (cond
    ((string-prefix? "python-" name) (snake-case name))
+   ((string-suffix? "-python" name)
+    (string-append "python-" (string-drop-right name 7)))
    ((or (string=? "trytond" name)
         (string-prefix? "trytond-" name)) (snake-case name))
    (else (string-append "python-" (snake-case name)))))

base-commit: e2f37229e5e7f6e73806d8087faf9e1e94ea9acf
-- 
2.49.0