You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-vim/youcompleteme/youcompleteme-99999999.ebuild

119 lines
3.0 KiB

# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python2_7 )
inherit eutils multilib python-single-r1 cmake-utils vcs-clean vim-plugin
if [[ ${PV} == 9999* ]] ; then
EGIT_REPO_URI="https://github.com/Valloric/YouCompleteMe.git"
inherit git-r3
else
KEYWORDS="~amd64 ~x86"
SRC_URI="https://dev.gentoo.org/~radhermit/vim/${P}.tar.xz"
fi
DESCRIPTION="vim plugin: a code-completion engine for Vim"
HOMEPAGE="https://valloric.github.io/YouCompleteMe/"
LICENSE="GPL-3"
IUSE="+clang test"
RESTRICT="!test? ( test )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
COMMON_DEPEND="
${PYTHON_DEPS}
clang? ( >=sys-devel/clang-3.3 )
$(python_gen_cond_dep '
dev-libs/boost[python,threads,${PYTHON_MULTI_USEDEP}]
')
|| (
app-editors/vim[python,${PYTHON_SINGLE_USEDEP}]
app-editors/gvim[python,${PYTHON_SINGLE_USEDEP}]
)
"
RDEPEND="
${COMMON_DEPEND}
$(python_gen_cond_dep '
dev-python/bottle[${PYTHON_MULTI_USEDEP}]
virtual/python-futures[${PYTHON_MULTI_USEDEP}]
dev-python/jedi[${PYTHON_MULTI_USEDEP}]
dev-python/requests[${PYTHON_MULTI_USEDEP}]
dev-python/sh[${PYTHON_MULTI_USEDEP}]
dev-python/waitress[${PYTHON_MULTI_USEDEP}]
')
"
DEPEND="
${COMMON_DEPEND}
test? (
$(python_gen_cond_dep '
>=dev-python/mock-1.0.1[${PYTHON_MULTI_USEDEP}]
>=dev-python/nose-1.3.0[${PYTHON_MULTI_USEDEP}]
')
>=dev-cpp/gtest-1.8.0
)
"
CMAKE_IN_SOURCE_BUILD=1
CMAKE_USE_DIR=${S}/third_party/ycmd/cpp
VIM_PLUGIN_HELPFILES="${PN}"
src_prepare() {
if ! use test; then
sed -i '/^add_subdirectory( tests )/d' third_party/ycmd/cpp/ycm/CMakeLists.txt || die
fi
for third_party_module in requests pythonfutures; do
if [[ -d "${third_party_module}" ]]; then
rm -r "${S}"/third_party/${third_party_module} || die "Failed to remove third party module ${third_party_module}"
fi
done
# Argparse is included in python 2.7
for third_party_module in argparse bottle jedi waitress sh requests; do
if [[ -d "${third_party_module}" ]]; then
rm -r "${S}"/third_party/ycmd/third_party/${third_party_module} || die "Failed to remove third party module ${third_party_module}"
fi
done
}
src_configure() {
local mycmakeargs=(
$(cmake-utils_use_use clang CLANG_COMPLETER)
$(cmake-utils_use_use clang SYSTEM_LIBCLANG)
-DUSE_SYSTEM_BOOST=ON
-DUSE_SYSTEM_GMOCK=ON
)
cmake-utils_src_configure
}
src_test() {
cd "${S}/third_party/ycmd/cpp/ycm/tests" || die
LD_LIBRARY_PATH="${EROOT}"/usr/$(get_libdir)/llvm \
./ycm_core_tests || die
cd "${S}"/python/ycm || die
local dirs=( "${S}"/third_party/*/ "${S}"/third_party/ycmd/third_party/*/ )
local -x PYTHONPATH=${PYTHONPATH}:$(IFS=:; echo "${dirs[*]}")
nosetests --verbose || die
}
src_install() {
dodoc *.md third_party/ycmd/*.md
rm -r *.md *.sh COPYING.txt third_party/ycmd/cpp || die
rm -r third_party/ycmd/{*.md,*.sh} || die
find python -name *test* -exec rm -rf {} + || die
egit_clean
rm third_party/ycmd/libclang.so* || die
vim-plugin_src_install
python_optimize "${ED}"
python_fix_shebang "${ED}"
}