diff options
Diffstat (limited to 'guix/import/pypi.scm')
-rw-r--r-- | guix/import/pypi.scm | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index f93fa8831f..b20c2300f6 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -510,23 +510,13 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE." ("MPL 2.0" license:mpl2.0) (_ #f))) -(define (pypi-package? package) - "Return true if PACKAGE is a Python package from PyPI." - - (define (pypi-url? url) - (or (string-prefix? "https://pypi.org/" url) - (string-prefix? "https://pypi.python.org/" url) - (string-prefix? "https://pypi.org/packages" url) - (string-prefix? "https://files.pythonhosted.org/packages" url))) - - (let ((source-url (and=> (package-source package) origin-uri)) - (fetch-method (and=> (package-source package) origin-method))) - (and (eq? fetch-method download:url-fetch) - (match source-url - ((? string?) - (pypi-url? source-url)) - ((source-url ...) - (any pypi-url? source-url)))))) +(define pypi-package? + (url-predicate + (lambda (url) + (or (string-prefix? "https://pypi.org/" url) + (string-prefix? "https://pypi.python.org/" url) + (string-prefix? "https://pypi.org/packages" url) + (string-prefix? "https://files.pythonhosted.org/packages" url))))) (define (latest-release package) "Return an <upstream-source> for the latest release of PACKAGE." |