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: Alex Vong
Subject: Re: [PATCH] gnu: youtube-dl: Add native-search-paths.
Date: Sun, 13 Dec 2015 22:36:26 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

>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.

* 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




reply via email to

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