Gentoo Archives: gentoo-dev

From: Anna Vyalkova <cyber+gentoo@×××××.in>
To: gentoo-dev@l.g.o
Cc: vim@g.o
Subject: [gentoo-dev] [PATCH v3 4/8] vim-plugin.eclass: EAPI 8: add src_prepare
Date: Wed, 06 Apr 2022 13:54:07
Message-Id: 20220406135203.24882-5-cyber+gentoo@sysrq.in
In Reply to: [gentoo-dev] [PATCH v3 0/8] Vim eclasses by Anna Vyalkova
1 Signed-off-by: Anna Vyalkova <cyber+gentoo@×××××.in>
2 ---
3 eclass/vim-plugin.eclass | 38 +++++++++++++++++++++++++++++++++++---
4 1 file changed, 35 insertions(+), 3 deletions(-)
5
6 diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
7 index abd5b326d5..0df323b143 100644
8 --- a/eclass/vim-plugin.eclass
9 +++ b/eclass/vim-plugin.eclass
10 @@ -13,7 +13,8 @@
11 # documentation, for which we make a special case via vim-doc.eclass.
12
13 case ${EAPI} in
14 - 6|7|8);;
15 + 6|7) ;;
16 + 8) _DEFINE_VIM_PLUGIN_SRC_PREPARE=true ;;
17 *) die "${ECLASS}: EAPI ${EAPI:-0} unsupported (too old)";;
18 esac
19
20 @@ -21,6 +22,17 @@ if [[ ! ${_VIM_PLUGIN_ECLASS} ]]; then
21
22 inherit vim-doc
23
24 +fi
25 +
26 +EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
27 +
28 +# src_prepare is only exported in EAPI >= 8
29 +case ${EAPI:-0} in
30 + 6|7) ;;
31 + 8) EXPORT_FUNCTIONS src_prepare ;;
32 +esac
33 +
34 +if [[ ! ${_VIM_PLUGIN_ECLASS} ]]; then
35 VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}"
36
37 DEPEND="|| ( >=app-editors/vim-${VIM_PLUGIN_VIM_VERSION}
38 @@ -32,6 +44,28 @@ if [[ ${PV} != 9999* ]] ; then
39 fi
40 SLOT="0"
41
42 +if ${_DEFINE_VIM_PLUGIN_SRC_PREPARE}; then
43 +# @FUNCTION: vim-plugin_src_prepare
44 +# @DESCRIPTION:
45 +# Moves "after/syntax" plugins to directories to avoid file collisions with
46 +# other packages.
47 +# Note that this function is only defined and exported in EAPIs >= 8.
48 +vim-plugin_src_prepare() {
49 + default_src_prepare
50 +
51 + # return if there's nothing to do
52 + [[ -d after/syntax ]] || return
53 +
54 + pushd after/syntax >/dev/null || die
55 + for file in *.vim; do
56 + [[ -f "${file}" ]] || continue
57 + mkdir "${file%.vim}" || die
58 + mv "${file}" "${file%.vim}/${PN}.vim" || die
59 + done
60 + popd >/dev/null || die
61 +}
62 +fi
63 +
64 # @ECLASS_VARIABLE: _VIM_PLUGIN_ALLOWED_DIRS
65 # @INTERNAL
66 # @DESCRIPTION:
67 @@ -188,5 +222,3 @@ display_vim_plugin_help() {
68
69 _VIM_PLUGIN_ECLASS=1
70 fi
71 -
72 -EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
73 --
74 2.35.1

Replies

Subject Author
Re: [gentoo-dev] [PATCH v3 4/8] vim-plugin.eclass: EAPI 8: add src_prepare Thomas Bracht Laumann Jespersen <t@×××××××.xyz>