Skip to content

Commit 728cba8

Browse files
committed
pyjnius: use cython
1 parent 8fdcec6 commit 728cba8

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

pythonforandroid/recipes/pyjnius/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ class PyjniusRecipe(PyProjectRecipe):
1111
name = 'pyjnius'
1212
depends = ['six']
1313
site_packages_name = 'jnius'
14-
patches = [('genericndkbuild_jnienv_getter.patch', will_build('genericndkbuild'))]
14+
patches = [('genericndkbuild_jnienv_getter.patch', will_build('genericndkbuild')), "use_cython.patch"]
1515

1616
def get_recipe_env(self, arch, **kwargs):
1717
env = super().get_recipe_env(arch, **kwargs)
1818
# NDKPLATFORM is our switch for detecting Android platform, so can't be None
1919
env['NDKPLATFORM'] = "NOTNONE"
20+
env['LIBLINK'] = "NOTNONE"
21+
env["ANDROID_PYJNIUS_CYTHON_3"] = "1"
22+
sdl_recipe = self.get_recipe("sdl2", self.ctx)
23+
env["LDFLAGS"] += " -L" + join(sdl_recipe.get_build_dir(arch.arch), "../..", "libs", arch.arch)
2024
return env
2125

2226
def postbuild_arch(self, arch):
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--- pyjnius-1.6.1/setup.py 2023-11-05 21:07:43.000000000 +0530
2+
+++ pyjnius-1.6.1.mod/setup.py 2025-03-01 14:47:11.964847337 +0530
3+
@@ -59,10 +59,6 @@
4+
if NDKPLATFORM is not None and getenv('LIBLINK'):
5+
PLATFORM = 'android'
6+
7+
-# detect platform
8+
-if PLATFORM == 'android':
9+
- PYX_FILES = [fn[:-3] + 'c' for fn in PYX_FILES]
10+
-
11+
JAVA=get_java_setup(PLATFORM)
12+
13+
assert JAVA.is_jdk(), "You need a JDK, we only found a JRE. Try setting JAVA_HOME"

pythonforandroid/toolchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ def _build_package(self, args, package_type):
10351035
# .../build/bootstrap_builds/sdl2-python3/gradlew
10361036
# if docker on windows, gradle contains CRLF
10371037
output = shprint(
1038-
sh.Command('dos2unix'), gradlew._path,
1038+
sh.Command('dos2unix'), gradlew._path.decode(encoding="utf-8"),
10391039
_tail=20, _critical=True, _env=env
10401040
)
10411041
if args.build_mode == "debug":

0 commit comments

Comments
 (0)