commit:     1209f9f0bd96f5bf326f7ccd780da84053fb1b97
Author:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 22 12:54:56 2023 +0000
Commit:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
CommitDate: Wed Feb 22 22:15:29 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1209f9f0

media-video/gaupol: add 1.12, switch to PEP517

In order to use PEP517, we need to prevent setup.py from using
setuptools-related variables to define the location of data files.

Closes: https://bugs.gentoo.org/839267
Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org>

 media-video/gaupol/Manifest                        |  1 +
 .../gaupol/files/gaupol-1.12-fix-prefix.patch      | 30 ++++++++++
 media-video/gaupol/gaupol-1.12.ebuild              | 69 ++++++++++++++++++++++
 3 files changed, 100 insertions(+)

diff --git a/media-video/gaupol/Manifest b/media-video/gaupol/Manifest
index 9ac89580c751..204e968018aa 100644
--- a/media-video/gaupol/Manifest
+++ b/media-video/gaupol/Manifest
@@ -1 +1,2 @@
 DIST gaupol-1.11.tar.gz 581799 BLAKE2B 
d0f4ad7c71086f585138bde79ba49f43e8e71eba7bc5ef5f0ac324ab962049cd1c71030f5a7d6ec859d4ac32dc7a07c8255ab01d98114629055f777f11210a2e
 SHA512 
8c623f6ed8d189a79a994545be3dd96ae7fec399216520bfe89587a9c0b5917e07b6d80fe1f8a7b2d016b9fb1aa544bdabe103428dc97ea78e6d8c05666d0e9c
+DIST gaupol-1.12.tar.gz 575537 BLAKE2B 
acedc1b73b6bea35d2853aa26117a7823767aeff3f9cd59ed828aa173c0ab4a46ef1433d169cd551b9d453289412aec31ede32e388dfc22d14e60e18b4c5ec0a
 SHA512 
7e8002ceeff0a6c1144a6c23743aff006101a63aee394c4a4eb2742ad37635fe45425964d60ab2d6f10f9e212c72db673f5f1d849f738efcd7d9389054a1de36

diff --git a/media-video/gaupol/files/gaupol-1.12-fix-prefix.patch 
b/media-video/gaupol/files/gaupol-1.12-fix-prefix.patch
new file mode 100644
index 000000000000..9aa0dd582c04
--- /dev/null
+++ b/media-video/gaupol/files/gaupol-1.12-fix-prefix.patch
@@ -0,0 +1,30 @@
+From b638bf5352194ba08b1139375e27523ce43834b0 Mon Sep 17 00:00:00 2001
+From: Louis Sautier <[email protected]>
+Date: Wed, 22 Feb 2023 13:49:26 +0100
+Subject: [PATCH] Rely on sys.prefix instead of setuptools-computed prefix
+
+When using PEP517 mode, we ended up with
+DATA_DIR = '/gaupol-1.12.data/data/share/gaupol'
+LOCALE_DIR = '/gaupol-1.11.data/data/share/locale'
+
+By relying on sys.prefix instead, we work around the issue.
+Bug: https://bugs.gentoo.org/839267
+--- a/setup.py
++++ b/setup.py
+@@ -335,11 +335,11 @@ class InstallLib(install_lib):
+         path = os.path.join(self.build_dir, "aeidon", "paths.py")
+         text = open(path, "r", encoding="utf_8").read()
+         patt = r"^DATA_DIR = .*$"
+-        repl = "DATA_DIR = {!r}".format(data_dir)
++        repl = 'DATA_DIR = os.path.join(sys.prefix, "share", "gaupol")'
+         text = re.sub(patt, repl, text, flags=re.MULTILINE)
+         assert text.count(repl) == 1
+         patt = r"^LOCALE_DIR = .*$"
+-        repl = "LOCALE_DIR = {!r}".format(locale_dir)
++        repl = 'LOCALE_DIR = os.path.join(sys.prefix, "share", "locale")'
+         text = re.sub(patt, repl, text, flags=re.MULTILINE)
+         assert text.count(repl) == 1
+         open(path, "w", encoding="utf_8").write(text)
+-- 
+2.39.2
+

diff --git a/media-video/gaupol/gaupol-1.12.ebuild 
b/media-video/gaupol/gaupol-1.12.ebuild
new file mode 100644
index 000000000000..17ce40934060
--- /dev/null
+++ b/media-video/gaupol/gaupol-1.12.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{9..11} )
+
+inherit distutils-r1 virtualx xdg-utils
+
+DESCRIPTION="A subtitle editor for text-based subtitles"
+HOMEPAGE="https://otsaloma.io/gaupol/ https://github.com/otsaloma/gaupol/";
+SRC_URI="https://github.com/otsaloma/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="spell"
+
+RDEPEND="
+       app-text/iso-codes
+       dev-python/chardet[${PYTHON_USEDEP}]
+       dev-python/pygobject:3[${PYTHON_USEDEP}]
+       x11-libs/gtk+:3[introspection]
+       spell? ( app-text/gspell[introspection] )
+"
+BDEPEND="
+       sys-devel/gettext
+       test? (
+               app-dicts/myspell-en
+               app-text/enchant[hunspell]
+               app-text/gspell[introspection]
+       )
+"
+
+distutils_enable_tests pytest
+
+DOCS=( AUTHORS.md NEWS.md README.md README.aeidon.md )
+
+PATCHES=(
+       "${FILESDIR}/${P}-fix-prefix.patch"
+)
+
+python_test() {
+       virtx epytest
+}
+
+pkg_postinst() {
+       xdg_desktop_database_update
+       xdg_icon_cache_update
+       if [[ -z ${REPLACING_VERSIONS} ]]; then
+               elog "The integrated video player requires 
media-plugins/gst-plugins-gtk."
+               elog ""
+               elog "External video previewing support requires MPV, MPlayer 
or VLC."
+               if use spell; then
+                       elog ""
+                       elog "Spell-checking requires a dictionary, any of 
app-dicts/myspell-*"
+                       elog "or app-text/aspell with the appropriate L10N 
variable."
+                       elog ""
+                       elog "Additionally, make sure that app-text/enchant has 
the correct flags enabled:"
+                       elog "USE=hunspell for myspell dictionaries and 
USE=aspell for aspell dictionaries."
+               fi
+       fi
+}
+
+pkg_postrm() {
+       xdg_desktop_database_update
+       xdg_icon_cache_update
+}

Reply via email to