Skip to content

Commit d6143f2

Browse files
committed
✨ Add bz2 and lzma support to Python3
1 parent 21d4d35 commit d6143f2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pythonforandroid/python.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,14 @@ def add_flags(include_flags, link_dirs, link_libs):
169169
add_flags(recipe.include_flags(arch),
170170
recipe.link_dirs_flags(arch), recipe.link_libs_flags())
171171

172+
for library_name in {'libbz2', 'liblzma'}:
173+
if library_name in self.ctx.recipe_build_order:
174+
info(f'Activating flags for {library_name}')
175+
recipe = Recipe.get_recipe(library_name, self.ctx)
176+
add_flags(recipe.get_library_includes(arch),
177+
recipe.get_library_ldflags(arch),
178+
recipe.get_library_libs_flag())
179+
172180
# python build system contains hardcoded zlib version which prevents
173181
# the build of zlib module, here we search for android's zlib version
174182
# and sets the right flags, so python can be build with android's zlib

pythonforandroid/recipes/python3/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ class Python3Recipe(GuestPythonRecipe):
3939
]
4040

4141
depends = ['hostpython3', 'sqlite3', 'openssl', 'libffi']
42+
# those optional depends allow us to build python compression modules:
43+
# - _bz2.so
44+
# - _lzma.so
45+
opt_depends = ['libbz2', 'liblzma']
4246
conflicts = ['python2']
4347

4448
configure_args = (

0 commit comments

Comments
 (0)