commit:     131ece7fff304dae10e8efb0fb600c5751092900
Author:     Sam James (sam_c) <sam <AT> cmpct <DOT> info>
AuthorDate: Wed Jun 17 20:44:06 2020 +0000
Commit:     Aaron Bauman <bman <AT> gentoo <DOT> org>
CommitDate: Sat Jun 20 00:22:35 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=131ece7f

media-video/subliminal: rewrite live ebuild to be agnostic

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sam James (sam_c) <sam <AT> cmpct.info>
Closes: https://github.com/gentoo/gentoo/pull/16084
Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>

 media-video/subliminal/subliminal-2.1.0.ebuild | 26 ++++++++++++++++++++-----
 media-video/subliminal/subliminal-9999.ebuild  | 27 ++++++++++++++++++--------
 2 files changed, 40 insertions(+), 13 deletions(-)

diff --git a/media-video/subliminal/subliminal-2.1.0.ebuild 
b/media-video/subliminal/subliminal-2.1.0.ebuild
index 9b14d3b3016..48473f15489 100644
--- a/media-video/subliminal/subliminal-2.1.0.ebuild
+++ b/media-video/subliminal/subliminal-2.1.0.ebuild
@@ -9,12 +9,19 @@ DISTUTILS_USE_SETUPTOOLS=rdepend
 
 inherit distutils-r1
 
+SRC_URI=""
+
+if [[ ${PV} == 9999 ]] ; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/Diaoul/${PN}.git";
+       EGIT_BRANCH="develop"
+else
+        SRC_URI="https://github.com/Diaoul/${PN}/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+fi
+
 DESCRIPTION="Python library to search and download subtitles"
 HOMEPAGE="https://github.com/Diaoul/subliminal 
https://pypi.org/project/subliminal/";
-SRC_URI="
-       https://github.com/Diaoul/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
-       test? ( mirror://sourceforge/matroska/test_files/matroska_test_w1_1.zip 
)
-"
+SRC_URI+=" test? ( 
mirror://sourceforge/matroska/test_files/matroska_test_w1_1.zip )"
 
 LICENSE="MIT"
 SLOT="0"
@@ -53,6 +60,15 @@ PATCHES=(
 
 distutils_enable_tests pytest
 
+src_unpack() {
+       # Needed to unpack the test data
+       default
+
+       if [[ ${PV} == 9999 ]] ; then
+               git-r3_src_unpack
+       fi
+}
+
 python_prepare_all() {
        # Disable code checkers as they require unavailable dependencies.
        sed -i -e 's/--\(pep8\|flakes\)//g' pytest.ini || die
@@ -60,7 +76,7 @@ python_prepare_all() {
        # Disable unconditional dependency on dev-python/pytest-runner.
        sed -i -e "s|'pytest-runner'||g" setup.py || die
 
-       if use test; then
+       if use test ; then
                mkdir -p tests/data/mkv || die
                ln -s "${WORKDIR}"/test*.mkv tests/data/mkv/ || die
        fi

diff --git a/media-video/subliminal/subliminal-9999.ebuild 
b/media-video/subliminal/subliminal-9999.ebuild
index 3043809fda4..54ade49d622 100644
--- a/media-video/subliminal/subliminal-9999.ebuild
+++ b/media-video/subliminal/subliminal-9999.ebuild
@@ -7,17 +7,24 @@ PYTHON_COMPAT=( python3_{6,7} )
 PYTHON_REQ_USE='xml(+)'
 DISTUTILS_USE_SETUPTOOLS=rdepend
 
-inherit distutils-r1 git-r3
+inherit distutils-r1
+
+SRC_URI=""
+
+if [[ ${PV} == 9999 ]] ; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/Diaoul/${PN}.git";
+       EGIT_BRANCH="develop"
+else
+       SRC_URI="https://github.com/Diaoul/${PN}/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+fi
 
 DESCRIPTION="Python library to search and download subtitles"
 HOMEPAGE="https://github.com/Diaoul/subliminal 
https://pypi.org/project/subliminal/";
-EGIT_REPO_URI="https://github.com/Diaoul/${PN}.git";
-EGIT_BRANCH="develop"
-SRC_URI="test? ( 
mirror://sourceforge/matroska/test_files/matroska_test_w1_1.zip )"
+SRC_URI+=" test? ( 
mirror://sourceforge/matroska/test_files/matroska_test_w1_1.zip )"
 
 LICENSE="MIT"
 SLOT="0"
-KEYWORDS=""
 IUSE="test"
 RESTRICT="!test? ( test )"
 
@@ -53,8 +60,12 @@ PATCHES=(
 distutils_enable_tests pytest
 
 src_unpack() {
-       default_src_unpack
-       git-r3_src_unpack
+       # Needed to unpack the test data
+       default
+
+       if [[ ${PV} == 9999 ]] ; then
+               git-r3_src_unpack
+       fi
 }
 
 python_prepare_all() {
@@ -64,7 +75,7 @@ python_prepare_all() {
        # Disable unconditional dependency on dev-python/pytest-runner.
        sed -i -e "s|'pytest-runner'||g" setup.py || die
 
-       if use test; then
+       if use test ; then
                mkdir -p tests/data/mkv || die
                ln -s "${WORKDIR}"/test*.mkv tests/data/mkv/ || die
        fi

Reply via email to