guix-commits
[Top][All Lists]
Advanced

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

01/01: build-system: python: Do not double wrap executables.


From: guix-commits
Subject: 01/01: build-system: python: Do not double wrap executables.
Date: Tue, 27 Nov 2018 05:36:42 -0500 (EST)

arunisaac pushed a commit to branch core-updates-next
in repository guix.

commit 89e7f90d0b40bc4f15f902cc3b82c3effa87dd02
Author: Arun Isaac <address@hidden>
Date:   Wed Jul 11 13:03:33 2018 +0530

    build-system: python: Do not double wrap executables.
    
    * guix/build/python-build-system.scm (wrap): Only wrap executables that have
    not already been wrapped.
    * guix/build/utils.scm (wrapper?): New function.
---
 guix/build/python-build-system.scm | 9 ++++-----
 guix/build/utils.scm               | 9 +++++++++
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/guix/build/python-build-system.scm 
b/guix/build/python-build-system.scm
index 5bb0ba4..73b554c 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2015, 2018 Mark H Weaver <address@hidden>
 ;;; Copyright © 2016 Hartmut Goebel <address@hidden>
 ;;; Copyright © 2018 Ricardo Wurmus <address@hidden>
+;;; Copyright © 2018 Arun Isaac <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -186,11 +187,9 @@ when running checks after installing the package."
 
 (define* (wrap #:key inputs outputs #:allow-other-keys)
   (define (list-of-files dir)
-    (map (cut string-append dir "/" <>)
-         (or (scandir dir (lambda (f)
-                            (let ((s (stat (string-append dir "/" f))))
-                              (eq? 'regular (stat:type s)))))
-             '())))
+    (find-files dir (lambda (file stat)
+                      (and (eq? 'regular (stat:type stat))
+                           (not (wrapper? file))))))
 
   (define bindirs
     (append-map (match-lambda
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 5fe3286..cb5621a 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2013 Andreas Enge <address@hidden>
 ;;; Copyright © 2013 Nikita Karetnikov <address@hidden>
 ;;; Copyright © 2015, 2018 Mark H Weaver <address@hidden>
+;;; Copyright © 2018 Arun Isaac <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -87,6 +88,7 @@
             patch-/usr/bin/file
             fold-port-matches
             remove-store-references
+            wrapper?
             wrap-program
 
             invoke
@@ -1003,6 +1005,13 @@ known as `nuke-refs' in Nixpkgs."
                              (put-u8 out (char->integer char))
                              result))))))
 
+(define (wrapper? prog)
+  "Return #t if PROG is a wrapper as produced by 'wrap-program'."
+  (and (file-exists? prog)
+       (let ((base (basename prog)))
+         (and (string-prefix? "." base)
+              (string-suffix? "-real" base)))))
+
 (define* (wrap-program prog #:rest vars)
   "Make a wrapper for PROG.  VARS should look like this:
 



reply via email to

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