Skip to content

Commit a529d77

Browse files
committed
Move from bpo-30386 to python 3.7.0 maintaining libs support
Includes commits from @inclement's pr "Python 3 recipe" (squashed into this commit):     - Moved from bpo-30386 branch to python 3.7.0 official distribution     - Made all version references in python url dynamic Plus, update the libs patches in order to work with python 3.7.0. References: kivy#1412, inclement/python-for-android@588f736 and inclement/python-for-android@a7f9348
1 parent b38c6ae commit a529d77

File tree

3 files changed

+55
-51
lines changed

3 files changed

+55
-51
lines changed

pythonforandroid/recipes/python3/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@
5252

5353

5454
class Python3Recipe(TargetPythonRecipe):
55-
version = 'bpo-30386'
56-
url = 'https://github.com/inclement/cpython/archive/{version}.zip'
55+
version = '3.7.0'
56+
url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz'
5757
name = 'python3'
5858

5959
depends = ['hostpython3']
6060
conflicts = ['python3crystax', 'python2']
6161
opt_depends = ['libffi', 'libexpat', 'openssl', 'sqlite3']
6262
# TODO: More patches maybe be needed, but with those
6363
# two we successfully build and run a simple app
64-
patches = ['patches/python-3.x.x-libs.patch',
64+
patches = ['patches/python-{version}-libs.patch'.format(version=version),
6565
'patches/fix-termios.patch']
6666

6767
def set_libs_flags(self, env, arch=None):
@@ -121,7 +121,7 @@ def set_libs_flags(self, env, arch=None):
121121

122122
# Sets special python compilation flags for some libs.
123123
# The openssl and sqlite env variables are set
124-
# via patch: patches/python-3.x.x-libs.patch
124+
# via patch: patches/python-3.7.0-libs.patch
125125
if lib == 'openssl':
126126
env['OPENSSL_BUILD'] = b
127127
env['OPENSSL_VERSION'] = r.version
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
diff -Naurp Python-3.7.0.orig/setup.py Python-3.7.0-xcompile/setup.py
2+
--- Python-3.7.0.orig/setup.py 2018-06-27 05:07:35.000000000 +0200
3+
+++ Python-3.7.0-xcompile/setup.py 2018-07-22 20:51:47.793048200 +0200
4+
@@ -1135,7 +1158,13 @@ class PyBuildExt(build_ext):
5+
'/usr/local/include/sqlite3',
6+
]
7+
if cross_compiling:
8+
- sqlite_inc_paths = []
9+
+ # The common install prefix of 3rd party headers used during
10+
+ # cross compilation
11+
+ mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX')
12+
+ if mydir:
13+
+ sqlite_inc_paths = [mydir + '/include']
14+
+ else:
15+
+ sqlite_inc_paths = []
16+
MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
17+
MIN_SQLITE_VERSION = ".".join([str(x)
18+
for x in MIN_SQLITE_VERSION_NUMBER])
19+
@@ -1186,8 +1215,9 @@ class PyBuildExt(build_ext):
20+
sqlite_dirs_to_check + lib_dirs, 'sqlite3')
21+
if sqlite_libfile:
22+
sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
23+
-
24+
- if sqlite_incdir and sqlite_libdir:
25+
+ sqlite_incdir = os.environ["SQLITE3_INC_DIR"]
26+
+ sqlite_libdir = [os.environ["SQLITE3_LIB_DIR"]]
27+
+ if os.path.isdir(sqlite_incdir) and os.path.isdir(sqlite_libdir[0]):
28+
sqlite_srcs = ['_sqlite/cache.c',
29+
'_sqlite/connection.c',
30+
'_sqlite/cursor.c',
31+
@@ -2138,8 +2168,9 @@ class PyBuildExt(build_ext):
32+
sep = ' ' + sep
33+
return [v.strip() for v in value.split(sep) if v.strip()]
34+
35+
- openssl_includes = split_var('OPENSSL_INCLUDES', '-I')
36+
- openssl_libdirs = split_var('OPENSSL_LDFLAGS', '-L')
37+
+ openssl_includes = [
38+
+ os.path.join(os.environ["OPENSSL_BUILD"], 'include')]
39+
+ openssl_libdirs = [os.environ["OPENSSL_BUILD"]]
40+
openssl_libs = split_var('OPENSSL_LIBS', '-l')
41+
if not openssl_libs:
42+
# libssl and libcrypto not found
43+
@@ -2147,7 +2178,7 @@ class PyBuildExt(build_ext):
44+
45+
# Find OpenSSL includes
46+
ssl_incs = find_file(
47+
- 'openssl/ssl.h', inc_dirs, openssl_includes
48+
+ 'openssl/ssl.h', openssl_includes, inc_dirs
49+
)
50+
if ssl_incs is None:
51+
return None, None

pythonforandroid/recipes/python3/patches/python-3.x.x-libs.patch

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)