guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

07/211: gnu: r-torch: Do not hardcode Python version.


From: guix-commits
Subject: 07/211: gnu: r-torch: Do not hardcode Python version.
Date: Tue, 20 Sep 2022 06:23:35 -0400 (EDT)

rekado pushed a commit to branch wip-r
in repository guix.

commit d5f148503813548236416bb132f63ad2524c5940
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Mon Sep 19 21:58:29 2022 +0200

    gnu: r-torch: Do not hardcode Python version.
    
    * gnu/packages/cran.scm (r-torch)[arguments]: Do not hardcode Python 
version 3.9.
---
 gnu/packages/cran.scm | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index af672c0c5e..46e6d8a380 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -24535,19 +24535,23 @@ Visualizations are also available for most of these 
settings.")
     (arguments
      (list
       #:phases
-      #~(modify-phases %standard-phases
-          (add-after 'install 'link-libraries
-            (lambda* (#:key inputs #:allow-other-keys)
-              (let ((deps (string-append #$output "/site-library/torch/deps")))
-                (mkdir-p deps)
-                (symlink
-                 (search-input-file
-                  inputs "/lib/python3.9/site-packages/torch/lib/libtorch.so")
-                 (string-append deps "/libtorch.so"))
-                (symlink
-                 (search-input-file
-                  inputs "/lib/liblantern.so")
-                 (string-append deps "/liblantern.so"))))))))
+      (let ((python-version (version-major+minor (package-version python))))
+        #~(modify-phases %standard-phases
+            (add-after 'install 'link-libraries
+              (lambda* (#:key inputs #:allow-other-keys)
+                (let ((deps (string-append #$output 
"/site-library/torch/deps"))
+                      (site-packages (string-append "/lib/python"
+                                                    #$python-version
+                                                    "/site-packages")))
+                  (mkdir-p deps)
+                  (symlink
+                   (search-input-file
+                    inputs (string-append site-packages 
"/torch/lib/libtorch.so"))
+                   (string-append deps "/libtorch.so"))
+                  (symlink
+                   (search-input-file
+                    inputs "/lib/liblantern.so")
+                   (string-append deps "/liblantern.so")))))))))
     (inputs
      (list python-pytorch-for-r-torch
            liblantern))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]