Skip to content

Commit 0490f4c

Browse files
committed
Enable sqlite support for python recipes
1 parent a67526d commit 0490f4c

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pythonforandroid/python.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,24 @@ class GuestPythonRecipe(TargetPythonRecipe):
162162
'''The file extensions from site packages dir that we don't want to be
163163
included in our python bundle.'''
164164

165+
opt_depends = ['sqlite3']
166+
'''The optional libraries which we would like to get our python linked'''
167+
165168
def __init__(self, *args, **kwargs):
166169
self._ctx = None
167170
super(GuestPythonRecipe, self).__init__(*args, **kwargs)
168171

172+
def set_libs_flags(self, env, arch):
173+
'''Takes care to properly link libraries with python depending on our
174+
requirements and the attribute :attr:`opt_depends`.
175+
'''
176+
if 'sqlite3' in self.ctx.recipe_build_order:
177+
info('Activating flags for sqlite3')
178+
recipe = Recipe.get_recipe('sqlite3', self.ctx)
179+
env['CPPFLAGS'] = env.get('CPPFLAGS', '') + recipe.get_build_dir(arch.arch)
180+
env['LDFLAGS'] = env.get('LDFLAGS', '') + recipe.get_lib_dir(arch) + ' -lsqlite3'
181+
return env
182+
169183
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
170184
if self.from_crystax:
171185
return \
@@ -321,6 +335,7 @@ def build_arch(self, arch):
321335

322336
with current_directory(build_dir):
323337
env = self.get_recipe_env(arch)
338+
env = self.set_libs_flags(env, arch)
324339

325340
android_build = sh.Command(
326341
join(recipe_build_dir,

pythonforandroid/recipes/python2/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class Python2Recipe(GuestPythonRecipe):
1818

1919
depends = ['hostpython2']
2020
conflicts = ['python3crystax', 'python3', 'python2legacy']
21-
# opt_depends = ['openssl', 'sqlite3']
2221

2322
patches = [
2423
# new 2.7.15 patches

0 commit comments

Comments
 (0)