guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] gnu: youtube-dl: Add native-search-paths.


From: Ludovic Courtès
Subject: Re: [PATCH] gnu: youtube-dl: Add native-search-paths.
Date: Sun, 13 Dec 2015 17:13:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Alex Vong <address@hidden> skribis:

> From 72c15c31d56c0b0e75766869060aba9693fc074e Mon Sep 17 00:00:00 2001
> From: Alex Vong <address@hidden>
> Date: Sun, 13 Dec 2015 22:03:39 +0800
> Subject: [PATCH] gnu: youtube-dl: Add phase to fix data_files paths so that
>  man page and completion files are installed to the right place.

It’s enough to write:

  gnu: youtube-dl: Install man pages and completion files.

because apparently none of them is currently installed, right?

> +     ;; The problem here is that the data_files paths are relative. Normally,
> +     ;; this is fine. However, for some reason, setup.py uses the 
> auto-detected
> +     ;; sys.prefix instead of the user-defined "--prefix=FOO". So, we need to
> +     ;; get the user-defined prefix in python and patch the data_files paths.

It seems that --prefix is at least partly honored, currently, because we
currently get binaries under bin/ and Python modules under lib/python/.

What about changing the comment to explicitly mention man pages and
completions?

> +     `(#:phases (modify-phases %standard-phases
> +                  (add-before 'install 'fix-data-files-paths
> +                    (lambda* _
> +                      (substitute* "setup.py"
> +                        (("import sys")
> +                         "import sys
> +import re
> +
> +map_ = lambda proc, ls: list(map(proc, ls))
> +find = lambda pred, ls: next(filter(pred, ls))
> +prefix = find(lambda x: bool(x),
> +              map_(lambda string: re.match(r'^--prefix=(.*)$', string),
> +                   sys.argv)).group(1)
> +")
> +                        (("'etc/")
> +                         "prefix + '/etc/")
> +                        (("'share/")
> +                         "prefix + '/share/")))))))

I think it’s simpler to omit the Python ‘prefix’ variable definition,
and so:

  (("'etc/")
   (string-append (assoc-ref outputs "out") "/etc"))

WDYT?

Note that bash-completion expects it to be under one of:

  share/bash-completion/completions/youtube-dl
  etc/bash_completion.d/youtube-dl

Thanks!

Ludo’.



reply via email to

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