@@ -15,44 +15,46 @@ class Python2Recipe(Recipe):
15
15
conflicts = ['python3' ]
16
16
opt_depends = ['openssl' ]
17
17
18
- def prebuild_armeabi (self ):
19
- build_dir = self .get_build_container_dir ('armeabi' )
18
+ def prebuild_arch (self , arch ):
19
+ build_dir = self .get_build_container_dir (arch . arch )
20
20
if exists (join (build_dir , '.patched' )):
21
21
info ('Python2 already patched, skipping.' )
22
22
return
23
- self .apply_patch (join ('patches' , 'Python-{}-xcompile.patch' .format (self .version )))
24
- self .apply_patch (join ('patches' , 'Python-{}-ctypes-disable-wchar.patch' .format (self .version )))
25
- self .apply_patch (join ('patches' , 'disable-modules.patch' ))
26
- self .apply_patch (join ('patches' , 'fix-locale.patch' ))
27
- self .apply_patch (join ('patches' , 'fix-gethostbyaddr.patch' ))
28
- self .apply_patch (join ('patches' , 'fix-setup-flags.patch' ))
29
- self .apply_patch (join ('patches' , 'fix-filesystemdefaultencoding.patch' ))
30
- self .apply_patch (join ('patches' , 'fix-termios.patch' ))
31
- self .apply_patch (join ('patches' , 'custom-loader.patch' ))
32
- self .apply_patch (join ('patches' , 'verbose-compilation.patch' ))
33
- self .apply_patch (join ('patches' , 'fix-remove-corefoundation.patch' ))
34
- self .apply_patch (join ('patches' , 'fix-dynamic-lookup.patch' ))
35
- self .apply_patch (join ('patches' , 'fix-dlfcn.patch' ))
36
- self .apply_patch (join ('patches' , 'parsetuple.patch' ))
37
- # self.apply_patch(join('patches', 'ctypes-find-library.patch'))
38
- self .apply_patch (join ('patches' , 'ctypes-find-library-updated.patch' ))
23
+ self .apply_patch (join ('patches' , 'Python-{}-xcompile.patch' .format (self .version )),
24
+ arch .arch )
25
+ self .apply_patch (join ('patches' , 'Python-{}-ctypes-disable-wchar.patch' .format (self .version )),
26
+ arch .arch )
27
+ self .apply_patch (join ('patches' , 'disable-modules.patch' ), arch .arch )
28
+ self .apply_patch (join ('patches' , 'fix-locale.patch' ), arch .arch )
29
+ self .apply_patch (join ('patches' , 'fix-gethostbyaddr.patch' ), arch .arch )
30
+ self .apply_patch (join ('patches' , 'fix-setup-flags.patch' ), arch .arch )
31
+ self .apply_patch (join ('patches' , 'fix-filesystemdefaultencoding.patch' ), arch .arch )
32
+ self .apply_patch (join ('patches' , 'fix-termios.patch' ), arch .arch )
33
+ self .apply_patch (join ('patches' , 'custom-loader.patch' ), arch .arch )
34
+ self .apply_patch (join ('patches' , 'verbose-compilation.patch' ), arch .arch )
35
+ self .apply_patch (join ('patches' , 'fix-remove-corefoundation.patch' ), arch .arch )
36
+ self .apply_patch (join ('patches' , 'fix-dynamic-lookup.patch' ), arch .arch )
37
+ self .apply_patch (join ('patches' , 'fix-dlfcn.patch' ), arch .arch )
38
+ self .apply_patch (join ('patches' , 'parsetuple.patch' ), arch .arch )
39
+ # self.apply_patch(join('patches', 'ctypes-find-library.patch'), arch.arch)
40
+ self .apply_patch (join ('patches' , 'ctypes-find-library-updated.patch' ), arch .arch )
39
41
40
42
if uname ()[0 ] == 'Linux' :
41
- self .apply_patch (join ('patches' , 'fix-configure-darwin.patch' ))
42
- self .apply_patch (join ('patches' , 'fix-distutils-darwin.patch' ))
43
+ self .apply_patch (join ('patches' , 'fix-configure-darwin.patch' ), arch . arch )
44
+ self .apply_patch (join ('patches' , 'fix-distutils-darwin.patch' ), arch . arch )
43
45
44
46
if self .ctx .android_api > 19 :
45
- self .apply_patch (join ('patches' , 'fix-ftime-removal.patch' ))
47
+ self .apply_patch (join ('patches' , 'fix-ftime-removal.patch' ), arch . arch )
46
48
47
49
shprint (sh .touch , join (build_dir , '.patched' ))
48
50
49
- def build_armeabi (self ):
51
+ def build_arch (self , arch ):
50
52
51
- if not exists (join (self .get_build_dir ('armeabi' ), 'libpython2.7.so' )):
53
+ if not exists (join (self .get_build_dir (arch . arch ), 'libpython2.7.so' )):
52
54
self .do_python_build ()
53
55
54
56
if not exists (self .ctx .get_python_install_dir ()):
55
- shprint (sh .cp , '-a' , join (self .get_build_dir ('armeabi' ), 'python-install' ),
57
+ shprint (sh .cp , '-a' , join (self .get_build_dir (arch . arch ), 'python-install' ),
56
58
self .ctx .get_python_install_dir ())
57
59
58
60
# This should be safe to run every time
@@ -61,11 +63,11 @@ def build_armeabi(self):
61
63
join (self .ctx .get_python_install_dir (), 'bin' , 'python.host' ))
62
64
self .ctx .hostpython = join (self .ctx .get_python_install_dir (), 'bin' , 'python.host' )
63
65
64
- if not exists (join (self .ctx .get_libs_dir ('armeabi' ), 'libpython2.7.so' )):
65
- shprint (sh .cp , join (self .get_build_dir ('armeabi' ), 'libpython2.7.so' ), self .ctx .get_libs_dir ('armeabi' ))
66
+ if not exists (join (self .ctx .get_libs_dir (arch . arch ), 'libpython2.7.so' )):
67
+ shprint (sh .cp , join (self .get_build_dir (arch . arch ), 'libpython2.7.so' ), self .ctx .get_libs_dir (arch . arch ))
66
68
67
69
68
- # # if exists(join(self.get_build_dir('armeabi' ), 'libpython2.7.so')):
70
+ # # if exists(join(self.get_build_dir(arch.arch ), 'libpython2.7.so')):
69
71
# if exists(join(self.ctx.libs_dir, 'libpython2.7.so')):
70
72
# info('libpython2.7.so already exists, skipping python build.')
71
73
# if not exists(join(self.ctx.get_python_install_dir(), 'libpython2.7.so')):
@@ -81,12 +83,12 @@ def do_python_build(self):
81
83
exit (1 )
82
84
83
85
hostpython_recipe = Recipe .get_recipe ('hostpython2' , self .ctx )
84
- shprint (sh .cp , self .ctx .hostpython , self .get_build_dir ('armeabi' ))
85
- shprint (sh .cp , self .ctx .hostpgen , self .get_build_dir ('armeabi' ))
86
- hostpython = join (self .get_build_dir ('armeabi' ), 'hostpython' )
87
- hostpgen = join (self .get_build_dir ('armeabi' ), 'hostpython' )
86
+ shprint (sh .cp , self .ctx .hostpython , self .get_build_dir (arch . arch ))
87
+ shprint (sh .cp , self .ctx .hostpgen , self .get_build_dir (arch . arch ))
88
+ hostpython = join (self .get_build_dir (arch . arch ), 'hostpython' )
89
+ hostpgen = join (self .get_build_dir (arch . arch ), 'hostpython' )
88
90
89
- with current_directory (self .get_build_dir ('armeabi' )):
91
+ with current_directory (self .get_build_dir (arch . arch )):
90
92
91
93
92
94
hostpython_recipe = Recipe .get_recipe ('hostpython2' , self .ctx )
@@ -104,7 +106,7 @@ def do_python_build(self):
104
106
# TODO need to add a should_build that checks if optional
105
107
# dependencies have changed (possibly in a generic way)
106
108
if 'openssl' in self .ctx .recipe_build_order :
107
- openssl_build_dir = Recipe .get_recipe ('openssl' , self .ctx ).get_build_dir ('armeabi' )
109
+ openssl_build_dir = Recipe .get_recipe ('openssl' , self .ctx ).get_build_dir (arch . arch )
108
110
env ['CFLAGS' ] = ' ' .join ([env ['CFLAGS' ],
109
111
'-I{}' .format (join (openssl_build_dir , 'include' ))])
110
112
env ['LDFLAGS' ] = ' ' .join ([env ['LDFLAGS' ],
0 commit comments