Signed-off-by: Anna (cybertailor) Vyalkova <[email protected]>
---
 eclass/vim-plugin.eclass | 39 ++++++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
index 0f838afc0c0..668999eefd6 100644
--- a/eclass/vim-plugin.eclass
+++ b/eclass/vim-plugin.eclass
@@ -28,6 +28,13 @@ esac
 
 [[ ${EAPI} != 7 ]] && _DEFINE_VIM_PLUGIN_SRC_PREPARE=true
 
+# @ECLASS_VARIABLE: VIM_PLUGIN_OPTIONAL
+# @PRE_INHERIT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-null value, no dependencies will be added and no phase
+# functions will be exported.
+
 # @ECLASS_VARIABLE: VIM_COMPAT
 # @PRE_INHERIT
 # @DEFAULT_UNSET
@@ -141,8 +148,10 @@ _vim_plugin_set_globals() {
                esac
        done
 
-       RDEPEND="|| ( ${VIM_DEPEND[@]} )"
-       BDEPEND="app-vim/helpztags"
+       if [[ ! ${VIM_PLUGIN_OPTIONAL} ]]; then
+               RDEPEND="|| ( ${VIM_DEPEND[@]} )"
+               BDEPEND="app-vim/helpztags"
+       fi
 }
 
 if ! _using_vim_pack; then
@@ -154,11 +163,13 @@ else
        unset -f _vim_plugin_set_globals
 fi
 
-if [[ ${PV} != 9999* ]] ; then
-       SRC_URI="mirror://gentoo/${P}.tar.bz2
-               https://dev.gentoo.org/~radhermit/vim/${P}.tar.bz2";
+if [[ ! ${VIM_PLUGIN_OPTIONAL} ]]; then
+       if [[ ${PV} != 9999* ]] ; then
+               SRC_URI="mirror://gentoo/${P}.tar.bz2
+                       https://dev.gentoo.org/~radhermit/vim/${P}.tar.bz2";
+       fi
+       SLOT="0"
 fi
-SLOT="0"
 
 # @ECLASS_VARIABLE: VIM
 # @DEFAULT_UNSET
@@ -512,13 +523,15 @@ display_vim_plugin_help() {
 
 fi
 
-# src_prepare is only exported in EAPI >= 8
-[[ ${_DEFINE_VIM_PLUGIN_SRC_PREPARE} ]] && EXPORT_FUNCTIONS src_prepare
+if [[ ! ${VIM_PLUGIN_OPTIONAL} ]]; then
+       # src_prepare is only exported in EAPI >= 8
+       [[ ${_DEFINE_VIM_PLUGIN_SRC_PREPARE} ]] && EXPORT_FUNCTIONS src_prepare
 
-# src_test is only exported in EAPI >= 9
-_using_vim_pack && EXPORT_FUNCTIONS src_test
+       # src_test is only exported in EAPI >= 9
+       _using_vim_pack && EXPORT_FUNCTIONS src_test
 
-# pkg_postrm is only exported in EAPI < 9
-_using_vim_pack || EXPORT_FUNCTIONS pkg_postrm
+       # pkg_postrm is only exported in EAPI < 9
+       _using_vim_pack || EXPORT_FUNCTIONS pkg_postrm
 
-EXPORT_FUNCTIONS src_install pkg_postinst
+       EXPORT_FUNCTIONS src_install pkg_postinst
+fi
-- 
2.52.0


Reply via email to