python-ncls: Set cython language_level to 3

This commit is contained in:
bipin kumar 2023-05-14 11:32:58 +05:30
parent 7d1367be81
commit 5d11149ba6
No known key found for this signature in database
GPG key ID: C67233497C15E476
2 changed files with 28 additions and 3 deletions

View file

@ -3,7 +3,7 @@
pkgname=python-ncls
_module=${pkgname#python-}
pkgver=0.0.67
pkgrel=2
pkgrel=3
pkgdesc="A wrapper for the nested containment list data structure"
arch=('x86_64')
url="https://github.com/biocore-ntnu/ncls"
@ -23,13 +23,20 @@ makedepends=(
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_module::1}/$_module/$_module-$pkgver.tar.gz"
"LICENSE")
"LICENSE"
"cython3.patch")
sha256sums=('fa3e673d60e97bb021a516287d74bb959870cf9d910ec82403b99c443d8f447e'
'48186409eb1721726d28884f40346a8380a893e95a50bef75584e2e9c2d4fcd5')
'48186409eb1721726d28884f40346a8380a893e95a50bef75584e2e9c2d4fcd5'
'174a620d7dce0952e9e657ff40f25e73f0f5a9e38c96fffc91ccbc20805a7ee4')
prepare() {
cp LICENSE "$_module-$pkgver"
cp cython3.patch "$_module-$pkgver"
rm "$_module-$pkgver"/ncls/src/{fncls.c,ncls.c,ncls32.c}
# Set cython language_level to 3
cd "$_module-$pkgver"
patch -p1 < cython3.patch
}
build() {

View file

@ -0,0 +1,18 @@
--- a/setup.py 2023-05-14 00:15:53.983680836 +0530
+++ b/setup.py 2023-05-14 00:17:57.185420794 +0530
@@ -63,12 +63,14 @@
"ncls.src.fncls", ["ncls/src/fncls.pyx", "ncls/src/fintervaldb.c"],
# define_macros=macros,
include_dirs=include_dirs)]
+for e in extensions:
+ e.cython_directives = {'language_level': "3"}
# using setuptools to cythonize if cython not found
# not recommended by cython docs, but still
try:
from Cython.Build import cythonize
- ext_modules = cythonize(extensions, language_level=2)
+ ext_modules = cythonize(extensions, compiler_directives={'language_level' : "3"})
except ImportError:
print()
print("Warning: Cannot compile with Cython. Using legacy build.")