2017-08-13 03:24:00 +02:00
|
|
|
import sh
|
2019-03-30 21:58:45 +01:00
|
|
|
from pythonforandroid.python import GuestPythonRecipe
|
|
|
|
from pythonforandroid.recipe import Recipe
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
class Python3Recipe(GuestPythonRecipe):
|
|
|
|
'''
|
|
|
|
The python3's recipe.
|
2017-08-13 03:24:00 +02:00
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
.. note:: This recipe can be built only against API 21+. Also, in order to
|
|
|
|
build certain python modules, we need to add some extra recipes to our
|
|
|
|
build requirements:
|
2017-08-13 03:24:00 +02:00
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
- ctypes: you must add the recipe for ``libffi``.
|
2017-08-13 03:24:00 +02:00
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
.. versionchanged:: 0.6.0
|
|
|
|
Refactored into class
|
|
|
|
:class:`~pythonforandroid.python.GuestPythonRecipe`
|
|
|
|
'''
|
2017-08-13 03:24:00 +02:00
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
version = '3.7.1'
|
|
|
|
url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz'
|
|
|
|
name = 'python3'
|
2017-08-13 03:24:00 +02:00
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
patches = ["patches/fix-ctypes-util-find-library.patch"]
|
|
|
|
|
|
|
|
if sh.which('lld') is not None:
|
|
|
|
patches = patches + ["patches/remove-fix-cortex-a8.patch"]
|
|
|
|
|
|
|
|
depends = ['hostpython3', 'sqlite3', 'openssl', 'libffi']
|
|
|
|
conflicts = ['python3crystax', 'python2', 'python2legacy']
|
|
|
|
|
|
|
|
configure_args = (
|
|
|
|
'--host={android_host}',
|
|
|
|
'--build={android_build}',
|
|
|
|
'--enable-shared',
|
|
|
|
'--disable-ipv6',
|
|
|
|
'ac_cv_file__dev_ptmx=yes',
|
|
|
|
'ac_cv_file__dev_ptc=no',
|
|
|
|
'--without-ensurepip',
|
|
|
|
'ac_cv_little_endian_double=yes',
|
|
|
|
'--prefix={prefix}',
|
|
|
|
'--exec-prefix={exec_prefix}')
|
|
|
|
|
|
|
|
def set_libs_flags(self, env, arch):
|
|
|
|
env = super(Python3Recipe, self).set_libs_flags(env, arch)
|
|
|
|
if 'openssl' in self.ctx.recipe_build_order:
|
|
|
|
recipe = Recipe.get_recipe('openssl', self.ctx)
|
|
|
|
self.configure_args += \
|
|
|
|
('--with-openssl=' + recipe.get_build_dir(arch.arch),)
|
|
|
|
return env
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
recipe = Python3Recipe()
|