From 4eaac4b722b180b433b75127a30b871aaf9f0913 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 8 Feb 2017 15:58:36 +0100 Subject: import: pypi: Correctly handle multiple-URL origins. Fixes . Reported by Sergei Trofimovich . * guix/import/pypi.scm (guix-package->pypi-name)[url->pypi-name]: New procedure. Rewrite body to match lists in addition to strings. * tests/pypi.scm ("guix-package->pypi-name, several URLs"): New test. --- guix/import/pypi.scm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'guix/import') diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index ed0d4297a4..1e433e3fb3 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 Ludovic Courtès +;;; Copyright © 2015, 2016, 2017 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -89,9 +89,16 @@ package." (define (guix-package->pypi-name package) "Given a Python PACKAGE built from pypi.python.org, return the name of the package on PyPI." - (let ((source-url (and=> (package-source package) origin-uri))) + (define (url->pypi-name url) (hyphen-package-name->name+version - (basename (file-sans-extension source-url))))) + (basename (file-sans-extension url)))) + + (match (and=> (package-source package) origin-uri) + ((? string? url) + (url->pypi-name url)) + ((lst ...) + (any url->pypi-name lst)) + (#f #f))) (define (wheel-url->extracted-directory wheel-url) (match (string-split (basename wheel-url) #\-) -- cgit v1.2.3