30
30
#error "Unsupported ABI"
31
31
#endif
32
32
"""
33
-
33
+ LATEST_FULL_VERSION = {
34
+ '3.5' : '3.5.4' ,
35
+ '3.6' : '3.6.4'
36
+ }
34
37
35
38
def realpath (fname ):
36
39
"""
@@ -58,8 +61,7 @@ def realpath(fname):
58
61
59
62
class Python3Recipe (TargetPythonRecipe ):
60
63
version = '3.5'
61
- url = ('https://github.com/crystax/android-vendor-python-{}-{}'
62
- '/archive/master.tar.gz' .format (* version .split ('.' )))
64
+ url = None
63
65
name = 'python3crystax'
64
66
65
67
depends = ['hostpython3crystax' ]
@@ -69,6 +71,8 @@ class Python3Recipe(TargetPythonRecipe):
69
71
70
72
def download_if_necessary (self ):
71
73
if 'openssl' in self .ctx .recipe_build_order :
74
+ full_version = LATEST_FULL_VERSION [self .version ]
75
+ Python3Recipe .url = 'https://www.python.org/ftp/python/{0}.{1}.{2}/Python-{0}.{1}.{2}.tgz' .format (* full_version .split ('.' ))
72
76
super (Python3Recipe , self ).download_if_necessary ()
73
77
74
78
def get_dir_name (self ):
@@ -153,6 +157,26 @@ def find_Android_mk(self):
153
157
if os .path .exists (mk_path ):
154
158
return mk_path
155
159
160
+ def prebuild_arch (self , arch ):
161
+ super (Python3Recipe , self ).prebuild_arch (arch )
162
+ if self .version == '3.6' :
163
+ Python3Recipe .patches = ['patch_python3.6.patch' ]
164
+ build_dir = self .get_build_dir (arch .arch )
165
+ shprint (sh .ln , '-sf' ,
166
+ realpath (join (build_dir , 'Lib/site-packages/README.txt' )),
167
+ join (build_dir , 'Lib/site-packages/README' ))
168
+ python_build_files = ['android.mk' , 'config.c' , 'interpreter.c' ]
169
+ ndk_build_tools_python_dir = join (self .ctx .ndk_dir , 'build' , 'tools' , 'build-target-python' )
170
+ for python_build_file in python_build_files :
171
+ shprint (sh .cp , join (ndk_build_tools_python_dir , python_build_file + '.3.5' ),
172
+ join (ndk_build_tools_python_dir , python_build_file + '.3.6' ))
173
+ ndk_sources_python_dir = join (self .ctx .ndk_dir , 'sources' , 'python' )
174
+ if not os .path .exists (join (ndk_sources_python_dir , '3.6' )):
175
+ os .mkdir (join (ndk_sources_python_dir , '3.6' ))
176
+ sh .sed ('s#3.5#3.6#' ,
177
+ join (ndk_sources_python_dir , '3.5/Android.mk' ),
178
+ _out = join (ndk_sources_python_dir , '3.6/Android.mk' ))
179
+
156
180
def build_arch (self , arch ):
157
181
# If openssl is needed we may have to recompile cPython to get the
158
182
# ssl.py module working properly
@@ -203,12 +227,12 @@ def build_arch(self, arch):
203
227
info ('Copying openssl libs to ndk' )
204
228
arch_ndk_lib = join (openssl_ndk_dir , 'libs' , arch .arch )
205
229
ensure_dir (arch_ndk_lib )
206
- shprint (sh .cp ,
207
- join (openssl_build_dir , 'libcrypto{}.so' .format (ssl_recipe .version )),
208
- join (openssl_build_dir , 'libcrypto.so' ))
209
- shprint (sh .cp ,
210
- join (openssl_build_dir , 'libssl{}.so' .format (ssl_recipe .version )),
211
- join (openssl_build_dir , 'libssl.so' ))
230
+ shprint (sh .ln , '-sf' ,
231
+ realpath ( join (openssl_build_dir , 'libcrypto{}.so' .format (ssl_recipe .version ) )),
232
+ join (openssl_build_dir , 'libcrypto.so' ))
233
+ shprint (sh .ln , '-sf' ,
234
+ realpath ( join (openssl_build_dir , 'libssl{}.so' .format (ssl_recipe .version ) )),
235
+ join (openssl_build_dir , 'libssl.so' ))
212
236
libs = ['libcrypto.a' , 'libcrypto.so' , 'libssl.a' , 'libssl.so' ]
213
237
cmd = [join (openssl_build_dir , lib ) for lib in libs ] + [arch_ndk_lib ]
214
238
shprint (sh .cp , '-f' , * cmd )
0 commit comments