diff mbox series

[bug#57460,14/20] refresh: Allow updating to a specific version (pypi)

Message ID ffbb897e4896073dc8de035ba375140e47ef7b64.1661691694.git.h.goebel@crazy-compilers.com
State New
Headers show
Series Refresh to specific version | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Hartmut Goebel Aug. 28, 2022, 1:18 p.m. UTC
* guix/import/pypi.scm(latest-release): Rename to (import-release),
  add keyword-argument 'version' and pass it on to called functions.
---
 guix/import/pypi.scm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 3e3e949283..1ab48de71b 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -13,6 +13,7 @@ 
 ;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
 ;;; Copyright © 2022 Vivien Kraus <vivien@planete-kraus.eu>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -556,15 +557,15 @@  source.  To build it from source, refer to the upstream repository at
          (string-prefix? "https://pypi.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."
   (let* ((pypi-name    (guix-package->pypi-name package))
          (pypi-package (pypi-fetch pypi-name)))
     (and pypi-package
          (guard (c ((missing-source-error? c) #f))
            (let* ((info    (pypi-project-info pypi-package))
-                  (version (project-info-version info))
-                  (dist    (source-release pypi-package))
+                  (version (or version (project-info-version info)))
+                  (dist    (source-release pypi-package version))
                   (url     (distribution-url dist)))
              (upstream-source
               (urls (list url))
@@ -574,7 +575,7 @@  source.  To build it from source, refer to the upstream repository at
                    #f))
               (input-changes
                (changed-inputs package
-                               (pypi->guix-package pypi-name)))
+                               (pypi->guix-package pypi-name #:version version)))
               (package (package-name package))
               (version version)))))))
 
@@ -583,4 +584,4 @@  source.  To build it from source, refer to the upstream repository at
    (name 'pypi)
    (description "Updater for PyPI packages")
    (pred pypi-package?)
-   (import latest-release)))
+   (import import-release)))