Skip to content

Commit 069a101

Browse files
committed
wip sqlite3 for python2 recipe;
1 parent 14009e8 commit 069a101

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

pythonforandroid/recipes/python2/__init__.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Python2Recipe(TargetPythonRecipe):
1414

1515
depends = ['hostpython2']
1616
conflicts = ['python3crystax', 'python3']
17-
opt_depends = ['openssl']
17+
opt_depends = ['openssl','sqlite3']
1818

1919
patches = ['patches/Python-{version}-xcompile.patch',
2020
'patches/Python-{version}-ctypes-disable-wchar.patch',
@@ -68,9 +68,6 @@ def build_arch(self, arch):
6868
# return
6969

7070
def do_python_build(self, arch):
71-
if 'sqlite' in self.ctx.recipe_build_order:
72-
print('sqlite support not yet enabled in python recipe')
73-
exit(1)
7471

7572
hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)
7673
shprint(sh.cp, self.ctx.hostpython, self.get_build_dir(arch.arch))
@@ -101,6 +98,18 @@ def do_python_build(self, arch):
10198
shprint(sh.cp, join(self.get_recipe_dir(), 'Setup.local-ssl'), setuplocal)
10299
shprint(sh.sed, '-i', 's#^SSL=.*#SSL={}#'.format(openssl_build_dir), setuplocal)
103100

101+
if 'sqlite3' in self.ctx.recipe_build_order:
102+
sqlite3recipe = Recipe.get_recipe('sqlite3', self.ctx)
103+
sqlite_inc_dir = sqlite3recipe.get_build_dir(arch.arch)
104+
sqlite_libs_dir = sqlite3recipe.get_lib_dir(arch)
105+
env['CFLAGS'] += ' -I' + sqlite_inc_dir
106+
env['LDFLAGS'] += ' -L' + sqlite_libs_dir + ' -lsqlite3'
107+
self.apply_patch('patches/enable-sqlite3.patch', arch.arch)
108+
shprint(sh.sed, '-i', 's#SQLITE_RECIPE_INC#{}#'.format(sqlite_inc_dir),
109+
join(self.get_build_dir(arch.arch), 'setup.py'))
110+
shprint(sh.sed, '-i', 's#SQLITE_RECIPE_LIB#{}#'.format(sqlite_libs_dir),
111+
join(self.get_build_dir(arch.arch), 'setup.py'))
112+
104113
configure = sh.Command('./configure')
105114
# AND: OFLAG isn't actually set, should it be?
106115
shprint(configure,

0 commit comments

Comments
 (0)