Subject: Re: [PATCH v2 1/2] build-system: python: Only wrap non-hidden executable files.

From: Clément Lassieur <[email-masked]>
Date: Fri, 13 Jul 2018 09:42:02 +0200

Arun Isaac <[email-masked]> writes:

> * guix/build/python-build-system.scm (wrap): Only wrap non-hidden executable
> files. This prevents wrapped executables from being wrapped once again.
> ---
>  guix/build/python-build-system.scm | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
> index 376ea81f1..37e35eec0 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 <[email-masked]>
>  ;;; Copyright © 2016 Hartmut Goebel <[email-masked]>
>  ;;; Copyright © 2018 Ricardo Wurmus <[email-masked]>
> +;;; Copyright © 2018 Arun Isaac <[email-masked]>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -189,7 +190,11 @@ when running checks after installing the package."
>      (map (cut string-append dir "/" <>)
>           (or (scandir dir (lambda (f)
>                              (let ((s (stat (string-append dir "/" f))))
> -                              (eq? 'regular (stat:type s)))))
> +                              (and (eq? 'regular (stat:type s))
> +                                   ;; Only wrap non-hidden files. This
> +                                   ;; prevents wrapped executables from being
> +                                   ;; wrapped again.
> +                                   (not (string-prefix? "." f))))))
>               '())))
>  
>    (define bindirs

What about adding a function like 'is-wrapped?'?  Because it could be
used somewhere else, and it would make the code self-descriptive.

It would check that the name looks like .xxx-real, and also check that
xxx exists.  (And check that it's an executable.)

WDYT?
Clément