summaryrefslogtreecommitdiff
path: root/guix/import/pypi.scm
diff options
context:
space:
mode:
authorJakub Kądziołka <kuba@kadziolka.net>2020-07-23 21:43:06 +0200
committerJakub Kądziołka <kuba@kadziolka.net>2020-07-23 21:43:06 +0200
commitd726b954baaeff876ce9728e00920fa45f529f9a (patch)
tree4b767b7586a1082dd2691bc33c3e45ace044e6e5 /guix/import/pypi.scm
parent9a74a7db8626bc139307d115f5cec2648f5273ad (diff)
parente165a2492d73d37c8b95d6970d453b9d88911ee6 (diff)
Merge branch 'master' into core-updates
Conflicts: gnu/packages/ruby.scm
Diffstat (limited to 'guix/import/pypi.scm')
-rw-r--r--guix/import/pypi.scm27
1 files changed, 9 insertions, 18 deletions
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index f93fa8831f..a2b5d995ef 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
+;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -63,7 +64,7 @@
(match-lambda
("" #f)
((? string? str) str)
- ((or #nil #f) #f)))
+ ((or 'null #f) #f)))
;; PyPI project.
(define-json-mapping <pypi-project> make-pypi-project pypi-project?
@@ -510,23 +511,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."