mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-26 06:18:07 -05:00
import: pypi: Allow updating to a specific version.
* guix/import/pypi.scm (latest-release): Rename to 'import-release', add #:version argument and pass it on to called functions.
This commit is contained in:
parent
3986caacae
commit
b82eb8d67a
1 changed files with 8 additions and 6 deletions
|
@ -13,6 +13,7 @@
|
||||||
;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
|
;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
|
||||||
;;; Copyright © 2022 Vivien Kraus <vivien@planete-kraus.eu>
|
;;; Copyright © 2022 Vivien Kraus <vivien@planete-kraus.eu>
|
||||||
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
|
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
|
||||||
|
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -556,15 +557,16 @@ (define pypi-package?
|
||||||
(string-prefix? "https://pypi.org/packages" url)
|
(string-prefix? "https://pypi.org/packages" url)
|
||||||
(string-prefix? "https://files.pythonhosted.org/packages" url)))))
|
(string-prefix? "https://files.pythonhosted.org/packages" url)))))
|
||||||
|
|
||||||
(define (latest-release package)
|
(define* (import-release package #:key (version #f))
|
||||||
"Return an <upstream-source> for the latest release of PACKAGE."
|
"Return an <upstream-source> for the latest release of PACKAGE. Optionally
|
||||||
|
include a VERSION string to fetch a specific version."
|
||||||
(let* ((pypi-name (guix-package->pypi-name package))
|
(let* ((pypi-name (guix-package->pypi-name package))
|
||||||
(pypi-package (pypi-fetch pypi-name)))
|
(pypi-package (pypi-fetch pypi-name)))
|
||||||
(and pypi-package
|
(and pypi-package
|
||||||
(guard (c ((missing-source-error? c) #f))
|
(guard (c ((missing-source-error? c) #f))
|
||||||
(let* ((info (pypi-project-info pypi-package))
|
(let* ((info (pypi-project-info pypi-package))
|
||||||
(version (project-info-version info))
|
(version (or version (project-info-version info)))
|
||||||
(dist (source-release pypi-package))
|
(dist (source-release pypi-package version))
|
||||||
(url (distribution-url dist)))
|
(url (distribution-url dist)))
|
||||||
(upstream-source
|
(upstream-source
|
||||||
(urls (list url))
|
(urls (list url))
|
||||||
|
@ -574,7 +576,7 @@ (define (latest-release package)
|
||||||
#f))
|
#f))
|
||||||
(input-changes
|
(input-changes
|
||||||
(changed-inputs package
|
(changed-inputs package
|
||||||
(pypi->guix-package pypi-name)))
|
(pypi->guix-package pypi-name #:version version)))
|
||||||
(package (package-name package))
|
(package (package-name package))
|
||||||
(version version)))))))
|
(version version)))))))
|
||||||
|
|
||||||
|
@ -583,4 +585,4 @@ (define %pypi-updater
|
||||||
(name 'pypi)
|
(name 'pypi)
|
||||||
(description "Updater for PyPI packages")
|
(description "Updater for PyPI packages")
|
||||||
(pred pypi-package?)
|
(pred pypi-package?)
|
||||||
(import latest-release)))
|
(import import-release)))
|
||||||
|
|
Loading…
Reference in a new issue