commit:     2541f261a8f6e95f0769badba4cd2ba518af790b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 20 21:15:25 2021 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Jun 20 21:15:25 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2541f261

stardict.eclass: [QA] add EAPI guard, add basic eclassdoc

* Declare supported EAPIs as: [QA] 6, 7
* Add inherit guards to die on unsupported/untested EAPIs
* Add guard to prevent multiple inherits

Signed-off-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 eclass/stardict.eclass | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/eclass/stardict.eclass b/eclass/stardict.eclass
index 5e96b01625c..0061353f4ab 100644
--- a/eclass/stardict.eclass
+++ b/eclass/stardict.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-# Author : Alastair Tse <liqu...@gentoo.org>
-#
-# Convienence class to do stardict dictionary installations.
-#
+# @NAME: stardict.eclass
+# @AUTHOR: Alastair Tse <liqu...@gentoo.org>
+# @SUPPORTED_EAPIS: 6 7
+# @BLURB: Convenience class to do stardict dictionary installations.
 # Usage:
 #   - Variables to set :
 #      * FROM_LANG     -  From this language
@@ -12,6 +12,16 @@
 #      * DICT_PREFIX   -  SRC_URI prefix, like "dictd_www.mova.org_"
 #         * DICT_SUFFIX   -  SRC_URI after the prefix.
 
+case ${EAPI:-0} in
+       [67]) ;;
+       *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+EXPORT_FUNCTIONS src_compile src_install
+
+if [[ -z ${_STARDICT_ECLASS} ]] ; then
+_STARDICT_ECLASS=1
+
 RESTRICT="strip"
 
 [ -z "${DICT_SUFFIX}" ] && DICT_SUFFIX=${PN#stardict-[[:lower:]]*-}
@@ -25,18 +35,22 @@ fi
 
 HOMEPAGE="http://stardict.sourceforge.net/";
 SRC_URI="mirror://sourceforge/stardict/${DICT_P}.tar.bz2"
+S="${WORKDIR}"/${DICT_P}
 
-IUSE="gzip"
-SLOT="0"
 LICENSE="GPL-2"
+SLOT="0"
+IUSE="gzip"
 
-DEPEND="|| ( >=app-text/stardict-2.4.2
+DEPEND="
+       || (
+               >=app-text/stardict-2.4.2
                app-text/sdcv
-               app-text/goldendict )
-       gzip? ( app-arch/gzip
-               app-text/dictd )"
-
-S=${WORKDIR}/${DICT_P}
+               app-text/goldendict
+       )
+       gzip? (
+               app-arch/gzip
+               app-text/dictd
+       )"
 
 stardict_src_compile() {
        if use gzip; then
@@ -56,4 +70,4 @@ stardict_src_install() {
        doins *.ifo
 }
 
-EXPORT_FUNCTIONS src_compile src_install
+fi

Reply via email to