dev-python/python-box: Make C extensions optional

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2023-08-27 18:04:33 +02:00
parent 69f68f42bf
commit 242553a42a
2 changed files with 17 additions and 1 deletions

View File

@@ -13,4 +13,7 @@
<remote-id type="github">cdgriffith/Box</remote-id>
<remote-id type="pypi">python-box</remote-id>
</upstream>
<use>
<flag name="native-extensions">Compiles native C extensions</flag>
</use>
</pkgmetadata>

View File

@@ -24,6 +24,7 @@ S=${WORKDIR}/${MY_P}
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+native-extensions"
RDEPEND="
dev-python/msgpack[${PYTHON_USEDEP}]
@@ -34,11 +35,23 @@ RDEPEND="
dev-python/tomli-w[${PYTHON_USEDEP}]
"
BDEPEND="
dev-python/cython[${PYTHON_USEDEP}]
native-extensions? (
dev-python/cython[${PYTHON_USEDEP}]
)
"
distutils_enable_tests pytest
src_prepare() {
if ! use native-extensions; then
# a cheap hack, extensions are auto-disabled if Cython.Build
# is not importable
> Cython.py || die
fi
distutils-r1_src_prepare
}
python_test() {
rm -rf box || die
epytest