@@ -15,44 +15,46 @@ class Python2Recipe(Recipe):
1515 conflicts = ['python3' ]
1616 opt_depends = ['openssl' ]
1717
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 )
2020 if exists (join (build_dir , '.patched' )):
2121 info ('Python2 already patched, skipping.' )
2222 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 )
3941
4042 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 )
4345
4446 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 )
4648
4749 shprint (sh .touch , join (build_dir , '.patched' ))
4850
49- def build_armeabi (self ):
51+ def build_arch (self , arch ):
5052
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' )):
5254 self .do_python_build ()
5355
5456 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' ),
5658 self .ctx .get_python_install_dir ())
5759
5860 # This should be safe to run every time
@@ -61,11 +63,11 @@ def build_armeabi(self):
6163 join (self .ctx .get_python_install_dir (), 'bin' , 'python.host' ))
6264 self .ctx .hostpython = join (self .ctx .get_python_install_dir (), 'bin' , 'python.host' )
6365
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 ))
6668
6769
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')):
6971 # if exists(join(self.ctx.libs_dir, 'libpython2.7.so')):
7072 # info('libpython2.7.so already exists, skipping python build.')
7173 # if not exists(join(self.ctx.get_python_install_dir(), 'libpython2.7.so')):
@@ -81,12 +83,12 @@ def do_python_build(self):
8183 exit (1 )
8284
8385 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' )
8890
89- with current_directory (self .get_build_dir ('armeabi' )):
91+ with current_directory (self .get_build_dir (arch . arch )):
9092
9193
9294 hostpython_recipe = Recipe .get_recipe ('hostpython2' , self .ctx )
@@ -104,7 +106,7 @@ def do_python_build(self):
104106 # TODO need to add a should_build that checks if optional
105107 # dependencies have changed (possibly in a generic way)
106108 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 )
108110 env ['CFLAGS' ] = ' ' .join ([env ['CFLAGS' ],
109111 '-I{}' .format (join (openssl_build_dir , 'include' ))])
110112 env ['LDFLAGS' ] = ' ' .join ([env ['LDFLAGS' ],
0 commit comments