Subject: [bug#31965] [PATCH] gnu: Add gaupol.

From: Pierre Neidhardt <[email-masked]>
Date: Mon, 25 Jun 2018 17:22:49 +0200

* gnu/packages/video.scm (gaupol): New variable.
---
 gnu/packages/video.scm | 67 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index ff0555708..bbac4361e 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -2967,3 +2967,70 @@ format and some of its derived file formats, including MP4.  It operates as a
 multiplexer and demultiplexer, and can mux video and audio in several formats
 using standalone executable files.")
     (license license:isc)))
+
+(define-public gaupol
+  (package
+    (name "gaupol")
+    (version "1.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/otsaloma/gaupol/archive/"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "12hy5x6s5xk81r75x0z4n6wpq8ygsxc4mbr47qcr0kq55kbvp6jj"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("gettext" ,gettext-minimal)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("python-pygobject" ,python-pygobject)
+       ("gtk+" ,gtk+)
+       ("python-pycairo" ,python-pycairo) ; Required or else clicking on a subtitle line fails.
+       ("python-chardet" ,python-chardet) ; Optional: Character encoding detection.
+       ("gtkspell3" ,gtkspell3)           ; Optional: Inline spell-checking.
+       ("iso-codes" ,iso-codes)           ; Optional: Translations.
+       ("gstreamer" ,gstreamer)
+       ("gst-libav" ,gst-libav)
+       ("gst-plugins-base" ,gst-plugins-base)
+       ("gst-plugins-good" ,gst-plugins-good)
+       ("gst-plugins-bad" ,gst-plugins-bad)
+       ("gst-plugins-ugly" ,gst-plugins-ugly)))
+    (arguments
+     `(#:tests? #f                      ; Tests seem to require networking.
+       #:phases
+       (modify-phases %standard-phases
+         ;; gaupol's setup.py script does not support one of the Python build
+         ;; system's default flags, "--single-version-externally-managed".
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "python" "setup.py" "install"
+                     (string-append "--prefix=" (assoc-ref outputs "out"))
+                     "--root=/")))
+         (add-after 'install 'wrap-gaupol
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (gst-plugin-path (getenv "GST_PLUGIN_SYSTEM_PATH"))
+                   (gi-typelib-path (getenv "GI_TYPELIB_PATH")))
+               (wrap-program (string-append out "/bin/gaupol")
+                 `("GST_PLUGIN_SYSTEM_PATH" ":" prefix (,gst-plugin-path))
+                 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))))
+             #t))
+         (add-after 'install 'patch-data-dir
+           ;; Fix some path variables that setup.py seems to garble.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (substitute* (string-append out "/lib/python3.6/site-packages/aeidon/paths.py")
+                 (("^DATA_DIR = .*$")
+                  (string-append "DATA_DIR = '" out "/share/gaupol'\n"))
+                 (("^LOCALE_DIR = .*$")
+                  (string-append "LOCALE_DIR = '" out "/share/locale'\n"))))
+             #t)))))
+    (synopsis "Editor for text-based subtitles")
+    (description
+     "Gaupol supports multiple subtitle file formats and provides means of
+creating subtitles, editing texts and timing subtitles to match video.  The
+user interface features a builtin video player and is designed with attention
+to convenience of translating and batch processing of multiple documents.")
+    (home-page "http://otsaloma.io/gaupol/")
+    (license license:gpl3+)))
-- 
2.17.1