dev-python/frozenlist: Add a flag to disable C extensions entirely

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny 2023-08-06 10:44:51 +02:00
parent 7e0bd57379
commit 4fb5c79cc8
No known key found for this signature in database
GPG Key ID: 639ADAE2329E240E
2 changed files with 18 additions and 5 deletions

View File

@ -22,11 +22,14 @@ SRC_URI="
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
IUSE="+native-extensions"
BDEPEND="
$(python_gen_cond_dep '
dev-python/cython[${PYTHON_USEDEP}]
' 'python*')
native-extensions? (
$(python_gen_cond_dep '
dev-python/cython[${PYTHON_USEDEP}]
' 'python*')
)
"
distutils_enable_tests pytest
@ -36,12 +39,16 @@ src_prepare() {
distutils-r1_src_prepare
}
python_configure() {
python_compile() {
# pypy is not using the C extension
if [[ ${EPYTHON} == python* ]]; then
if use native-extensions && [[ ${EPYTHON} == python* ]]; then
> .install-cython || die
emake cythonize
else
local -x FROZENLIST_NO_EXTENSIONS=1
fi
distutils-r1_python_compile
}
python_test() {

View File

@ -8,4 +8,10 @@
<remote-id type="pypi">frozenlist</remote-id>
<remote-id type="github">aio-libs/frozenlist</remote-id>
</upstream>
<use>
<flag name="native-extensions">
Compile native C extensions (speedups, instead of using Python
fallback code).
</flag>
</use>
</pkgmetadata>