Skip getting version from Cython on Android. Instead add ANDROID_PYJNIUS_CYTHON_3 env var (#692)

This commit is contained in:
Mirko Galimberti 2023-11-03 18:44:04 +01:00 committed by GitHub
parent f746f1339c
commit e0f52ba87b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -87,8 +87,11 @@ compile_native_invocation_handler(JAVA)
# generate the config.pxi
with open(join(dirname(__file__), 'jnius', 'config.pxi'), 'w') as fd:
import Cython
cython3 = Cython.__version__.startswith('3.')
if PLATFORM == 'android':
cython3 = environ.get('ANDROID_PYJNIUS_CYTHON_3', '0') == '1'
else:
import Cython
cython3 = Cython.__version__.startswith('3.')
fd.write('DEF JNIUS_PLATFORM = {0!r}\n\n'.format(PLATFORM))
# record the Cython version, to address #669
fd.write(f'DEF JNIUS_CYTHON_3 = {cython3}')