diff mbox

[1/3] build-system/python: Add pypi-origin.

Message ID 1466202812-18604-2-git-send-email-donttrustben@gmail.com
State New
Headers show

Commit Message

Ben Woodcroft June 17, 2016, 10:33 p.m. UTC
* guix/build-system/python.scm (pypi-origin): New macro.
---
 guix/build-system/python.scm | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index c3d6c62..c40fd03 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -2,6 +2,7 @@ 
 ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
+;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -35,7 +36,8 @@ 
             strip-python2-variant
             python-build
             python-build-system
-            pypi-uri))
+            pypi-uri
+            pypi-origin))
 
 ;; Commentary:
 ;;
@@ -52,6 +54,25 @@  extension, such as '.tar.gz'."
                  (string-take name 1) "/" name "/"
                  name "-" version extension))
 
+(define-syntax-rule
+  (pypi-origin name version extension blake2 sha256-string ...)
+  (origin
+    (method url-fetch)
+    (uri (string-append
+          "https://pypi.python.org/packages/"
+          (substring blake2 0 2)
+          "/"
+          (substring blake2 2 4)
+          "/"
+          (substring blake2 4)
+          "/"
+          name
+          "-"
+          version
+          extension))
+    (sha256 (base32 sha256-string))
+    ...))
+
 (define %python-build-system-modules
   ;; Build-side modules imported by default.
   `((guix build python-build-system)