From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Vong Subject: Re: [PATCH] gnu: youtube-dl: Add native-search-paths. Date: Sun, 13 Dec 2015 22:36:26 +0800 Message-ID: <874mfm76vp.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a87lL-0000R8-EK for guix-devel@gnu.org; Sun, 13 Dec 2015 09:36:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a87lG-0001TF-Em for guix-devel@gnu.org; Sun, 13 Dec 2015 09:36:35 -0500 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]:36698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a87lG-0001T9-97 for guix-devel@gnu.org; Sun, 13 Dec 2015 09:36:30 -0500 Received: by pacdm15 with SMTP id dm15so90093454pac.3 for ; Sun, 13 Dec 2015 06:36:29 -0800 (PST) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ricardo Wurmus Cc: guix-devel@gnu.org >From 72c15c31d56c0b0e75766869060aba9693fc074e Mon Sep 17 00:00:00 2001 From: Alex Vong 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. * gnu/packages/video.scm (youtube-dl) [arguments]: Add fix-data-files-paths phase. --- gnu/packages/video.scm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm index 76374e2..730348c 100644 --- a/gnu/packages/video.scm +++ b/gnu/packages/video.scm @@ -822,6 +822,29 @@ projects while introducing many more.") (build-system python-build-system) (native-inputs `(("python-setuptools" ,python-setuptools))) (home-page "http://youtube-dl.org") + (arguments + ;; 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. + `(#: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/"))))))) (synopsis "Download videos from YouTube.com and other sites") (description "Youtube-dl is a small command-line program to download videos from -- 2.6.3