From 694fc7db8cbb50419d87d4c122937f5a8837efab Mon Sep 17 00:00:00 2001 From: Zhu Zihao Date: Fri, 22 Aug 2025 22:57:43 +0800 Subject: [PATCH] gnu: yt-dlp: Use G-expressions. * gnu/packages/video.scm (yt-dlp)[source], [arguments]: Use G-expressions. <#:phases>{build-generated-files}: Replace deprecated (assoc-ref input "package-name") with search-input-file. Change-Id: I7451459af058dbecad31705bb66d69395279e6aa Signed-off-by: Andreas Enge --- gnu/packages/video.scm | 84 +++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm index 15e48ec252f9bc26fb131b6c615e02610b4e162e..d0c318ef29b2a4e26863a8854a0fa009b783ecd7 100644 --- a/gnu/packages/video.scm +++ b/gnu/packages/video.scm @@ -73,6 +73,7 @@ ;;; Copyright © 2025 Formbi ;;; Copyright © 2025 Sharlatan Hellseher ;;; Copyright © 2025 VnPower +;;; Copyright © 2025 Zhu Zihao ;;; ;;; This file is part of GNU Guix. ;;; @@ -3152,54 +3153,55 @@ video streaming services of the Finnish national broadcasting company Yle.") (commit version))) (file-name (git-file-name name version)) (modules '((guix build utils))) - (snippet '(substitute* "pyproject.toml" - (("^.*Programming Language :: Python :: 3\\.13.*$") ""))) + (snippet #~(substitute* "pyproject.toml" + (("^.*Programming Language :: Python :: 3\\.13.*$") ""))) (sha256 (base32 "051y9pb2imdrpi065d9l2xfmd68l22ahbz90z81yqv7kv84j9mal")))) (build-system pyproject-build-system) (arguments - `(#:tests? ,(not (%current-target-system)) - #:test-flags '("--ignore=test/test_websockets.py") - #:phases - (modify-phases %standard-phases - ;; See . - ;; ffmpeg is big but required to request free formats from, e.g., - ;; YouTube so pull it in unconditionally. Continue respecting the - ;; --ffmpeg-location argument. - (add-after 'unpack 'default-to-the-ffmpeg-input - (lambda* (#:key inputs #:allow-other-keys) - (substitute* "yt_dlp/postprocessor/ffmpeg.py" - (("location = self.get_param(.*)$") - (string-append + (list + #:tests? (not (%current-target-system)) + #:test-flags #~'("--ignore=test/test_websockets.py") + #:phases + #~(modify-phases %standard-phases + ;; See . + ;; ffmpeg is big but required to request free formats from, e.g., + ;; YouTube so pull it in unconditionally. Continue respecting the + ;; --ffmpeg-location argument. + (add-after 'unpack 'default-to-the-ffmpeg-input + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "yt_dlp/postprocessor/ffmpeg.py" + (("location = self.get_param(.*)$") + (string-append "location = '" (dirname (search-input-file inputs "bin/ffmpeg")) "'\n"))))) - (add-before 'build 'build-generated-files - (lambda* (#:key inputs #:allow-other-keys) - (if (assoc-ref inputs "pandoc") - (invoke "make" - "PYTHON=python" - "yt-dlp" - "yt-dlp.1" - "completions") - (invoke "make" - "PYTHON=python" - "yt-dlp" - "completions")))) - (replace 'check - (lambda* (#:key tests? test-flags #:allow-other-keys) - (when tests? - (apply invoke "pytest" - "-k" - (string-append - "not download" - ;; TestHTTPRequestHandler tests are disabled due to - ;; https://github.com/yt-dlp/yt-dlp/issues/13927 - " and not " - "test_incompleteread" - " and not " - "test_partial_read_then_full_read") - test-flags))))))) + (add-before 'build 'build-generated-files + (lambda* (#:key inputs #:allow-other-keys) + (if (search-input-file inputs "bin/pandoc") + (invoke "make" + "PYTHON=python" + "yt-dlp" + "yt-dlp.1" + "completions") + (invoke "make" + "PYTHON=python" + "yt-dlp" + "completions")))) + (replace 'check + (lambda* (#:key tests? test-flags #:allow-other-keys) + (when tests? + (apply invoke "pytest" + "-k" + (string-append + "not download" + ;; TestHTTPRequestHandler tests are disabled due to + ;; https://github.com/yt-dlp/yt-dlp/issues/13927 + " and not " + "test_incompleteread" + " and not " + "test_partial_read_then_full_read") + test-flags))))))) (inputs (list ffmpeg python-brotli python-certifi python-mutagen