This is an automated email from the git hooks/post-receive script.

guix_mirror_bot pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new faac1c2bf0 import/pypi: Improve renaming procedure.
faac1c2bf0 is described below

commit faac1c2bf08ec9fda10a95b54c5a59e19aeebc21
Author: Hartmut Goebel <[email protected]>
AuthorDate: Tue Sep 23 19:10:17 2025 +0200

    import/pypi: Improve renaming procedure.
    
    PyPI canonicalizes dashes to underscores, while the former tests for
    converting to Guix-compliant name compared using dashes.  Solve this by
    canonicalizing to dashes prior to comparing.
    
    * guix/import/pypi.scm (python->package-name): Canonicalize names prior to
    testing.
    
    Change-Id: Iba2003720adba82a7f6e3f6319b2699e369163ed
---
 guix/import/pypi.scm | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 6b342ca99a..80d184a80c 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -183,13 +183,14 @@ or #f if there isn't any."
 (define (python->package-name name)
   "Given the NAME of a package on PyPI, return a Guix-compliant name for the
 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)))))
+  (let ((name (snake-case name)))
+    (cond
+     ((string-prefix? "python-" name) name)
+     ((string-suffix? "-python" name)
+      (string-append "python-" (string-drop-right name 7)))
+     ((or (string=? "trytond" name)
+          (string-prefix? "trytond-" name)) name)
+     (else (string-append "python-" name)))))
 
 (define (guix-package->pypi-name package)
   "Given a Python PACKAGE built from pypi.org, return the name of the

Reply via email to