summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-08-27 18:04:33 +0200
committerMichał Górny <mgorny@gentoo.org>2023-08-27 18:12:17 +0200
commit242553a42af2e68eea912319c42fb8b4e073ed81 (patch)
tree68b8bef149c05b67ad7d8da8a313b05d78ada237 /dev-python/python-box
parentsys-kernel/gentoo-sources: drop 6.4.9 (diff)
downloadgentoo-242553a42af2e68eea912319c42fb8b4e073ed81.tar.gz
gentoo-242553a42af2e68eea912319c42fb8b4e073ed81.tar.bz2
gentoo-242553a42af2e68eea912319c42fb8b4e073ed81.zip
dev-python/python-box: Make C extensions optional
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/python-box')
-rw-r--r--dev-python/python-box/metadata.xml3
-rw-r--r--dev-python/python-box/python-box-7.1.1.ebuild15
2 files changed, 17 insertions, 1 deletions
diff --git a/dev-python/python-box/metadata.xml b/dev-python/python-box/metadata.xml
index c0dbbdd823f3..a825fd0ab27e 100644
--- a/dev-python/python-box/metadata.xml
+++ b/dev-python/python-box/metadata.xml
@@ -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>
diff --git a/dev-python/python-box/python-box-7.1.1.ebuild b/dev-python/python-box/python-box-7.1.1.ebuild
index 56e494cdc8a1..a71c7fcf6444 100644
--- a/dev-python/python-box/python-box-7.1.1.ebuild
+++ b/dev-python/python-box/python-box-7.1.1.ebuild
@@ -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