Gentoo Archives: gentoo-commits

From: Patrice Clement <monsieurp@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Mon, 30 May 2022 12:57:15
Message-Id: 1653915422.72d55e0f005d399231b34eaed9dd279c4ccf1378.monsieurp@gentoo
1 commit: 72d55e0f005d399231b34eaed9dd279c4ccf1378
2 Author: Anna Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
3 AuthorDate: Wed Apr 6 11:34:18 2022 +0000
4 Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
5 CommitDate: Mon May 30 12:57:02 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=72d55e0f
7
8 vim-plugin.eclass: EAPI 8: add src_prepare
9
10 Signed-off-by: Anna Vyalkova <cyber+gentoo <AT> sysrq.in>
11 Signed-off-by: Patrice Clement <monsieurp <AT> gentoo.org>
12
13 eclass/vim-plugin.eclass | 32 +++++++++++++++++++++++++++++++-
14 1 file changed, 31 insertions(+), 1 deletion(-)
15
16 diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
17 index 0c323e0d09e7..9d300ad4826b 100644
18 --- a/eclass/vim-plugin.eclass
19 +++ b/eclass/vim-plugin.eclass
20 @@ -13,7 +13,8 @@
21 # documentation, for which we make a special case via vim-doc.eclass.
22
23 case ${EAPI} in
24 - 6|7|8) ;;
25 + 6|7) ;;
26 + 8) _DEFINE_VIM_PLUGIN_SRC_PREPARE=true ;;
27 *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
28 esac
29
30 @@ -32,6 +33,29 @@ if [[ ${PV} != 9999* ]] ; then
31 fi
32 SLOT="0"
33
34 +if [[ ${_DEFINE_VIM_PLUGIN_SRC_PREPARE} ]]; then
35 +# @FUNCTION: vim-plugin_src_prepare
36 +# @USAGE:
37 +# @DESCRIPTION:
38 +# Moves "after/syntax" plugins to directories to avoid file collisions with
39 +# other packages.
40 +# Note that this function is only defined and exported in EAPIs >= 8.
41 +vim-plugin_src_prepare() {
42 + default_src_prepare
43 +
44 + # return if there's nothing to do
45 + [[ -d after/syntax ]] || return
46 +
47 + pushd after/syntax >/dev/null || die
48 + for file in *.vim; do
49 + [[ -f "${file}" ]] || continue
50 + mkdir "${file%.vim}" || die
51 + mv "${file}" "${file%.vim}/${PN}.vim" || die
52 + done
53 + popd >/dev/null || die
54 +}
55 +fi
56 +
57 # @ECLASS_VARIABLE: _VIM_PLUGIN_ALLOWED_DIRS
58 # @INTERNAL
59 # @DESCRIPTION:
60 @@ -190,3 +214,9 @@ _VIM_PLUGIN_ECLASS=1
61 fi
62
63 EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
64 +
65 +# src_prepare is only exported in EAPI >= 8
66 +case ${EAPI} in
67 + 6|7) ;;
68 + *) EXPORT_FUNCTIONS src_prepare ;;
69 +esac